15#include "llvm/Config/llvm-config.h"
53 unsigned LastGlobalValueID = 0;
57 bool isGlobalValue(
unsigned ID)
const {
58 return ID <= LastGlobalValueID;
61 unsigned size()
const {
return IDs.
size(); }
62 std::pair<unsigned, bool> &operator[](
const Value *V) {
return IDs[
V]; }
64 std::pair<unsigned, bool>
lookup(
const Value *V)
const {
68 void index(
const Value *V) {
70 unsigned ID = IDs.
size() + 1;
78 if (OM.lookup(V).first)
81 if (
const Constant *
C = dyn_cast<Constant>(V)) {
82 if (
C->getNumOperands()) {
83 for (
const Value *
Op :
C->operands())
84 if (!isa<BasicBlock>(
Op) && !isa<GlobalValue>(
Op))
86 if (
auto *CE = dyn_cast<ConstantExpr>(
C))
87 if (CE->getOpcode() == Instruction::ShuffleVector)
88 orderValue(CE->getShuffleMaskForBitcode(), OM);
118 OM.LastGlobalValueID = OM.size();
120 auto orderConstantValue = [&OM](
const Value *V) {
121 if (isa<Constant>(V) || isa<InlineAsm>(V))
126 if (
F.isDeclaration())
138 auto OrderConstantFromMetadata = [&](
Metadata *MD) {
139 if (
const auto *VAM = dyn_cast<ValueAsMetadata>(MD)) {
140 orderConstantValue(VAM->getValue());
141 }
else if (
const auto *AL = dyn_cast<DIArgList>(MD)) {
142 for (
const auto *VAM : AL->getArgs())
143 orderConstantValue(VAM->getValue());
148 OrderConstantFromMetadata(DVR.getRawLocation());
149 if (DVR.isDbgAssign())
150 OrderConstantFromMetadata(DVR.getRawAddress());
153 for (
const Value *V :
I.operands()) {
154 if (
const auto *MAV = dyn_cast<MetadataAsValue>(V))
155 OrderConstantFromMetadata(MAV->getMetadata());
163 for (
const Value *
Op :
I.operands())
164 orderConstantValue(
Op);
165 if (
auto *SVI = dyn_cast<ShuffleVectorInst>(&
I))
166 orderValue(SVI->getShuffleMaskForBitcode(), OM);
174 unsigned ID,
const OrderMap &OM,
177 using Entry = std::pair<const Use *, unsigned>;
179 for (
const Use &U : V->uses())
181 if (OM.lookup(U.getUser()).first)
182 List.push_back(std::make_pair(&U,
List.size()));
188 bool IsGlobalValue = OM.isGlobalValue(
ID);
190 const Use *LU = L.first;
191 const Use *RU = R.first;
195 auto LID = OM.lookup(LU->getUser()).first;
196 auto RID = OM.lookup(RU->getUser()).first;
216 return LU->getOperandNo() < RU->getOperandNo();
217 return LU->getOperandNo() > RU->getOperandNo();
225 Stack.emplace_back(V,
F,
List.size());
226 assert(
List.size() == Stack.back().Shuffle.size() &&
"Wrong size");
227 for (
size_t I = 0, E =
List.size();
I != E; ++
I)
228 Stack.back().Shuffle[
I] =
List[
I].second;
233 auto &IDPair = OM[V];
234 assert(IDPair.first &&
"Unmapped value");
240 IDPair.second =
true;
241 if (!V->use_empty() && std::next(V->use_begin()) != V->use_end())
245 if (
const Constant *
C = dyn_cast<Constant>(V)) {
246 if (
C->getNumOperands()) {
247 for (
const Value *
Op :
C->operands())
248 if (isa<Constant>(
Op))
250 if (
auto *CE = dyn_cast<ConstantExpr>(
C))
251 if (CE->getOpcode() == Instruction::ShuffleVector)
272 auto PredictValueOrderFromMetadata = [&](
Metadata *MD) {
273 if (
const auto *VAM = dyn_cast<ValueAsMetadata>(MD)) {
275 }
else if (
const auto *AL = dyn_cast<DIArgList>(MD)) {
276 for (
const auto *VAM : AL->getArgs())
280 if (
F.isDeclaration())
289 PredictValueOrderFromMetadata(DVR.getRawLocation());
290 if (DVR.isDbgAssign())
291 PredictValueOrderFromMetadata(DVR.getRawAddress());
293 for (
const Value *
Op :
I.operands()) {
294 if (isa<Constant>(*
Op) || isa<InlineAsm>(*
Op))
296 if (
const auto *MAV = dyn_cast<MetadataAsValue>(
Op))
297 PredictValueOrderFromMetadata(MAV->getMetadata());
299 if (
auto *SVI = dyn_cast<ShuffleVectorInst>(&
I))
318 if (
G.hasInitializer())
325 for (
const Use &U :
F.operands())
333 return V.first->getType()->isIntOrIntVectorTy();
337 bool ShouldPreserveUseListOrder)
338 : ShouldPreserveUseListOrder(ShouldPreserveUseListOrder) {
339 if (ShouldPreserveUseListOrder)
345 EnumerateType(GV.getValueType());
351 EnumerateType(
F.getValueType());
352 EnumerateAttributes(
F.getAttributes());
358 EnumerateType(GA.getValueType());
363 EnumerateValue(&GIF);
364 EnumerateType(GIF.getValueType());
368 unsigned FirstConstant = Values.size();
372 if (GV.hasInitializer())
373 EnumerateValue(GV.getInitializer());
374 if (GV.hasAttributes())
380 EnumerateValue(GA.getAliasee());
384 EnumerateValue(GIF.getResolver());
388 for (
const Use &U :
F.operands())
389 EnumerateValue(U.get());
399 EnumerateValueSymbolTable(M.getValueSymbolTable());
400 EnumerateNamedMetadata(M);
405 GV.getAllMetadata(MDs);
406 for (
const auto &
I : MDs)
410 EnumerateMetadata(
nullptr,
I.second);
416 EnumerateType(
A.getType());
420 F.getAllMetadata(MDs);
421 for (
const auto &
I : MDs)
422 EnumerateMetadata(
F.isDeclaration() ?
nullptr : &
F,
I.second);
429 auto EnumerateNonLocalValuesFromMetadata = [&](
Metadata *MD) {
430 assert(MD &&
"Metadata unexpectedly null");
431 if (
const auto *AL = dyn_cast<DIArgList>(MD)) {
432 for (
const auto *VAM : AL->getArgs()) {
433 if (isa<ConstantAsMetadata>(VAM))
434 EnumerateMetadata(&
F, VAM);
439 if (!isa<LocalAsMetadata>(MD))
440 EnumerateMetadata(&
F, MD);
445 EnumerateMetadata(&
F, DLR->getLabel());
446 EnumerateMetadata(&
F, &*DLR->getDebugLoc());
461 for (
const Use &
Op :
I.operands()) {
462 auto *MD = dyn_cast<MetadataAsValue>(&
Op);
464 EnumerateOperandType(
Op);
468 EnumerateNonLocalValuesFromMetadata(MD->getMetadata());
470 if (
auto *SVI = dyn_cast<ShuffleVectorInst>(&
I))
471 EnumerateType(SVI->getShuffleMaskForBitcode()->getType());
472 if (
auto *
GEP = dyn_cast<GetElementPtrInst>(&
I))
473 EnumerateType(
GEP->getSourceElementType());
474 if (
auto *AI = dyn_cast<AllocaInst>(&
I))
475 EnumerateType(AI->getAllocatedType());
476 EnumerateType(
I.getType());
477 if (
const auto *Call = dyn_cast<CallBase>(&
I)) {
478 EnumerateAttributes(Call->getAttributes());
479 EnumerateType(Call->getFunctionType());
484 I.getAllMetadataOtherThanDebugLoc(MDs);
485 for (
unsigned i = 0, e = MDs.size(); i != e; ++i)
486 EnumerateMetadata(&
F, MDs[i].second);
492 EnumerateMetadata(&
F,
Op);
497 OptimizeConstants(FirstConstant, Values.size());
505 assert(
I != InstructionMap.
end() &&
"Instruction is not mapped!");
510 unsigned ComdatID = Comdats.
idFor(
C);
511 assert(ComdatID &&
"Comdat not found!");
516 InstructionMap[
I] = InstructionCount++;
520 if (
auto *MD = dyn_cast<MetadataAsValue>(V))
528#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
538 const char *
Name)
const {
539 OS <<
"Map Name: " <<
Name <<
"\n";
540 OS <<
"Size: " << Map.size() <<
"\n";
541 for (
const auto &
I : Map) {
544 OS <<
"Value: " << V->getName();
546 OS <<
"Value: [null]\n";
550 OS <<
" Uses(" << V->getNumUses() <<
"):";
551 for (
const Use &U : V->uses()) {
552 if (&U != &*V->use_begin())
555 OS <<
" " << U->getName();
565 const char *
Name)
const {
566 OS <<
"Map Name: " <<
Name <<
"\n";
567 OS <<
"Size: " << Map.size() <<
"\n";
568 for (
const auto &
I : Map) {
570 OS <<
"Metadata: slot = " <<
I.second.ID <<
"\n";
571 OS <<
"Metadata: function = " <<
I.second.F <<
"\n";
578void ValueEnumerator::OptimizeConstants(
unsigned CstStart,
unsigned CstEnd) {
579 if (CstStart == CstEnd || CstStart+1 == CstEnd)
return;
581 if (ShouldPreserveUseListOrder)
586 std::stable_sort(Values.begin() + CstStart, Values.begin() + CstEnd,
587 [
this](
const std::pair<const Value *, unsigned> &LHS,
588 const std::pair<const Value *, unsigned> &RHS) {
590 if (LHS.first->getType() != RHS.first->getType())
591 return getTypeID(LHS.first->getType()) < getTypeID(RHS.first->getType());
593 return LHS.second > RHS.second;
599 std::stable_partition(Values.begin() + CstStart, Values.begin() + CstEnd,
603 for (; CstStart != CstEnd; ++CstStart)
604 ValueMap[Values[CstStart].first] = CstStart+1;
609void ValueEnumerator::EnumerateValueSymbolTable(
const ValueSymbolTable &VST) {
612 EnumerateValue(VI->getValue());
617void ValueEnumerator::EnumerateNamedMetadata(
const Module &M) {
618 for (
const auto &
I :
M.named_metadata())
619 EnumerateNamedMDNode(&
I);
622void ValueEnumerator::EnumerateNamedMDNode(
const NamedMDNode *MD) {
624 EnumerateMetadata(
nullptr,
N);
627unsigned ValueEnumerator::getMetadataFunctionID(
const Function *
F)
const {
632 EnumerateMetadata(getMetadataFunctionID(
F), MD);
635void ValueEnumerator::EnumerateFunctionLocalMetadata(
637 EnumerateFunctionLocalMetadata(getMetadataFunctionID(&
F),
Local);
640void ValueEnumerator::EnumerateFunctionLocalListMetadata(
642 EnumerateFunctionLocalListMetadata(getMetadataFunctionID(&
F), ArgList);
645void ValueEnumerator::dropFunctionFromMetadata(
646 MetadataMapType::value_type &FirstMD) {
649 auto &
Entry = MD.second;
661 if (
auto *
N = dyn_cast<MDNode>(MD.first))
665 while (!Worklist.
empty())
669 auto MD = MetadataMap.
find(
Op);
670 if (MD != MetadataMap.
end())
675void ValueEnumerator::EnumerateMetadata(
unsigned F,
const Metadata *MD) {
685 if (
const MDNode *
N = enumerateMetadataImpl(
F, MD))
686 Worklist.
push_back(std::make_pair(
N,
N->op_begin()));
688 while (!Worklist.
empty()) {
694 Worklist.
back().second,
N->op_end(),
695 [&](
const Metadata *MD) { return enumerateMetadataImpl(F, MD); });
696 if (
I !=
N->op_end()) {
697 auto *
Op = cast<MDNode>(*
I);
698 Worklist.
back().second = ++
I;
701 if (
Op->isDistinct() && !
N->isDistinct())
711 MetadataMap[
N].ID = MDs.size();
715 if (Worklist.
empty() || Worklist.
back().first->isDistinct()) {
716 for (
const MDNode *
N : DelayedDistinctNodes)
717 Worklist.
push_back(std::make_pair(
N,
N->op_begin()));
718 DelayedDistinctNodes.clear();
723const MDNode *ValueEnumerator::enumerateMetadataImpl(
unsigned F,
const Metadata *MD) {
728 (isa<MDNode>(MD) || isa<MDString>(MD) || isa<ConstantAsMetadata>(MD)) &&
729 "Invalid metadata kind");
731 auto Insertion = MetadataMap.
insert(std::make_pair(MD, MDIndex(
F)));
732 MDIndex &
Entry = Insertion.first->second;
733 if (!Insertion.second) {
735 if (
Entry.hasDifferentFunction(
F))
736 dropFunctionFromMetadata(*Insertion.first);
741 if (
auto *
N = dyn_cast<MDNode>(MD))
746 Entry.ID = MDs.size();
749 if (
auto *
C = dyn_cast<ConstantAsMetadata>(MD))
750 EnumerateValue(
C->getValue());
757void ValueEnumerator::EnumerateFunctionLocalMetadata(
759 assert(
F &&
"Expected a function");
768 MDs.push_back(
Local);
770 Index.ID = MDs.size();
772 EnumerateValue(
Local->getValue());
777void ValueEnumerator::EnumerateFunctionLocalListMetadata(
779 assert(
F &&
"Expected a function");
782 MDIndex &
Index = MetadataMap[ArgList];
789 if (isa<LocalAsMetadata>(VAM)) {
791 "LocalAsMetadata should be enumerated before DIArgList");
793 "Expected LocalAsMetadata in the same function");
795 assert(isa<ConstantAsMetadata>(VAM) &&
796 "Expected LocalAsMetadata or ConstantAsMetadata");
798 "Constant should be enumerated beforeDIArgList");
799 EnumerateMetadata(
F, VAM);
803 MDs.push_back(ArgList);
805 Index.ID = MDs.size();
810 if (isa<MDString>(MD))
815 auto *
N = dyn_cast<MDNode>(MD);
821 return N->isDistinct() ? 2 : 3;
824void ValueEnumerator::organizeMetadata() {
826 "Metadata map and vector out of sync");
844 llvm::sort(Order, [
this](MDIndex LHS, MDIndex RHS) {
851 std::vector<const Metadata *> OldMDs;
853 MDs.reserve(OldMDs.size());
854 for (
unsigned I = 0, E = Order.
size();
I != E && !Order[
I].F; ++
I) {
855 auto *MD = Order[
I].get(OldMDs);
857 MetadataMap[MD].ID =
I + 1;
858 if (isa<MDString>(MD))
863 if (MDs.size() == Order.
size())
868 FunctionMDs.reserve(OldMDs.size());
870 for (
unsigned I = MDs.size(), E = Order.
size(),
ID = MDs.size();
I != E;
872 unsigned F = Order[
I].F;
875 }
else if (PrevF !=
F) {
876 R.Last = FunctionMDs.size();
878 R.First = FunctionMDs.size();
884 auto *MD = Order[
I].get(OldMDs);
885 FunctionMDs.push_back(MD);
886 MetadataMap[MD].ID = ++
ID;
887 if (isa<MDString>(MD))
890 R.Last = FunctionMDs.size();
891 FunctionMDInfo[PrevF] =
R;
894void ValueEnumerator::incorporateFunctionMetadata(
const Function &
F) {
895 NumModuleMDs = MDs.size();
898 NumMDStrings =
R.NumStrings;
899 MDs.insert(MDs.end(), FunctionMDs.begin() +
R.First,
900 FunctionMDs.begin() +
R.Last);
903void ValueEnumerator::EnumerateValue(
const Value *V) {
904 assert(!
V->getType()->isVoidTy() &&
"Can't insert void values!");
905 assert(!isa<MetadataAsValue>(V) &&
"EnumerateValue doesn't handle Metadata!");
911 Values[ValueID-1].second++;
915 if (
auto *GO = dyn_cast<GlobalObject>(V))
916 if (
const Comdat *
C = GO->getComdat())
920 EnumerateType(
V->getType());
922 if (
const Constant *
C = dyn_cast<Constant>(V)) {
923 if (isa<GlobalValue>(
C)) {
925 }
else if (
C->getNumOperands()) {
934 for (
const Use &U :
C->operands())
935 if (!isa<BasicBlock>(U))
937 if (
auto *CE = dyn_cast<ConstantExpr>(
C)) {
938 if (
CE->getOpcode() == Instruction::ShuffleVector)
939 EnumerateValue(
CE->getShuffleMaskForBitcode());
940 if (
auto *
GEP = dyn_cast<GEPOperator>(CE))
941 EnumerateType(
GEP->getSourceElementType());
946 Values.push_back(std::make_pair(V, 1U));
953 Values.push_back(std::make_pair(V, 1U));
954 ValueID = Values.size();
958void ValueEnumerator::EnumerateType(
Type *Ty) {
959 unsigned *
TypeID = &TypeMap[Ty];
968 if (
StructType *STy = dyn_cast<StructType>(Ty))
969 if (!STy->isLiteral())
975 EnumerateType(SubTy);
996void ValueEnumerator::EnumerateOperandType(
const Value *V) {
997 EnumerateType(
V->getType());
999 assert(!isa<MetadataAsValue>(V) &&
"Unexpected metadata operand");
1001 const Constant *
C = dyn_cast<Constant>(V);
1012 for (
const Value *
Op :
C->operands()) {
1015 if (isa<BasicBlock>(
Op))
1018 EnumerateOperandType(
Op);
1020 if (
auto *CE = dyn_cast<ConstantExpr>(
C)) {
1021 if (
CE->getOpcode() == Instruction::ShuffleVector)
1022 EnumerateOperandType(
CE->getShuffleMaskForBitcode());
1023 if (
CE->getOpcode() == Instruction::GetElementPtr)
1024 EnumerateType(cast<GEPOperator>(CE)->getSourceElementType());
1028void ValueEnumerator::EnumerateAttributes(
AttributeList PAL) {
1032 unsigned &
Entry = AttributeListMap[PAL];
1035 AttributeLists.push_back(PAL);
1036 Entry = AttributeLists.size();
1040 for (
unsigned i : PAL.
indexes()) {
1045 unsigned &
Entry = AttributeGroupMap[Pair];
1047 AttributeGroups.push_back(Pair);
1048 Entry = AttributeGroups.size();
1051 if (Attr.isTypeAttribute())
1052 EnumerateType(Attr.getValueAsType());
1059 InstructionCount = 0;
1060 NumModuleValues = Values.size();
1064 incorporateFunctionMetadata(
F);
1067 for (
const auto &
I :
F.args()) {
1069 if (
I.hasAttribute(Attribute::ByVal))
1070 EnumerateType(
I.getParamByValType());
1071 else if (
I.hasAttribute(Attribute::StructRet))
1072 EnumerateType(
I.getParamStructRetType());
1073 else if (
I.hasAttribute(Attribute::ByRef))
1074 EnumerateType(
I.getParamByRefType());
1076 FirstFuncConstantID = Values.size();
1081 for (
const Use &OI :
I.operands()) {
1082 if ((isa<Constant>(OI) && !isa<GlobalValue>(OI)) || isa<InlineAsm>(OI))
1085 if (
auto *SVI = dyn_cast<ShuffleVectorInst>(&
I))
1086 EnumerateValue(SVI->getShuffleMaskForBitcode());
1088 BasicBlocks.push_back(&BB);
1089 ValueMap[&BB] = BasicBlocks.size();
1093 OptimizeConstants(FirstFuncConstantID, Values.size());
1097 EnumerateAttributes(
F.getAttributes());
1099 FirstInstID = Values.size();
1104 auto AddFnLocalMetadata = [&](
Metadata *MD) {
1107 if (
auto *
Local = dyn_cast<LocalAsMetadata>(MD)) {
1110 }
else if (
auto *ArgList = dyn_cast<DIArgList>(MD)) {
1113 if (
auto *
Local = dyn_cast<LocalAsMetadata>(VMD)) {
1125 for (
const Use &OI :
I.operands()) {
1126 if (
auto *MD = dyn_cast<MetadataAsValue>(&OI))
1127 AddFnLocalMetadata(MD->getMetadata());
1131 assert(DVR.getRawLocation() &&
1132 "DbgVariableRecord location unexpectedly null");
1133 AddFnLocalMetadata(DVR.getRawLocation());
1134 if (DVR.isDbgAssign()) {
1135 assert(DVR.getRawAddress() &&
1136 "DbgVariableRecord location unexpectedly null");
1137 AddFnLocalMetadata(DVR.getRawAddress());
1140 if (!
I.getType()->isVoidTy())
1150 "Missing value for metadata operand");
1151 EnumerateFunctionLocalMetadata(
F,
Local);
1155 for (
const DIArgList *ArgList : ArgListMDVector)
1156 EnumerateFunctionLocalListMetadata(
F, ArgList);
1164 MetadataMap.
erase(MD);
1168 Values.resize(NumModuleValues);
1169 MDs.resize(NumModuleMDs);
1170 BasicBlocks.clear();
1176 unsigned Counter = 0;
1178 IDMap[&BB] = ++Counter;
1185 unsigned &
Idx = GlobalBasicBlockIDs[BB];
MapVector< const Value *, unsigned > OrderMap
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
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.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallVector class.
static void predictValueUseListOrderImpl(const Value *V, const Function *F, unsigned ID, const OrderMap &OM, UseListOrderStack &Stack)
static unsigned getMetadataTypeOrder(const Metadata *MD)
static void orderValue(const Value *V, OrderMap &OM)
static void predictValueUseListOrder(const Value *V, const Function *F, OrderMap &OM, UseListOrderStack &Stack)
static UseListOrderStack predictUseListOrder(const Module &M)
static void IncorporateFunctionInfoGlobalBBIDs(const Function *F, DenseMap< const BasicBlock *, unsigned > &IDMap)
static bool isIntOrIntVectorValue(const std::pair< const Value *, unsigned > &V)
static OrderMap orderModule(const Module &M)
This class represents an incoming formal argument to a Function.
index_iterator indexes() const
Use this to iterate over the valid attribute indexes.
bool isEmpty() const
Return true if there are no attributes.
AttributeSet getAttributes(unsigned Index) const
The attributes for the specified index are returned.
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
This class represents an Operation in the Expression.
Records a position in IR for a source label (DILabel).
Base class for non-instruction debug metadata records that have positions within IR.
DebugLoc getDebugLoc() const
Record of a variable value-assignment, aka a non instruction representation of the dbg....
DIAssignID * getAssignID() const
DIExpression * getExpression() const
DILocalVariable * getVariable() const
Metadata * getRawLocation() const
Returns the metadata operand for the first location description.
Metadata * getRawAddress() const
DIExpression * getAddressExpression() 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)
bool erase(const KeyT &Val)
size_type count(const_arg_type_t< KeyT > Val) const
Return 1 if the specified key is in the map, 0 otherwise.
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
Tracking metadata reference owned by Metadata.
A Module instance is used to store all the information related to an LLVM module.
iterator_range< op_iterator > operands()
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.
Class to represent struct types.
The instances of the Type class are immutable: once they are created, they are never changed.
static Type * getMetadataTy(LLVMContext &C)
TypeID
Definitions of all of the base types for the Type system.
ArrayRef< Type * > subtypes() const
unsigned insert(const T &Entry)
insert - Append entry to the vector if it doesn't already exist.
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.
unsigned getMetadataID(const Metadata *MD) const
UseListOrderStack UseListOrders
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
size_type count(const KeyT &Val) const
Return 1 if the specified key is in the map, 0 otherwise.
iterator find(const KeyT &Val)
bool erase(const KeyT &Val)
This class provides a symbol table of name/value pairs.
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.
This class implements an extremely fast bulk output stream that can only output to a stream.
@ C
The default llvm calling convention, compatible with C.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ CE
Windows NT (Windows on ARM)
This is an optimization pass for GlobalISel generic memory operations.
auto drop_begin(T &&RangeOrContainer, size_t N=1)
Return a range covering RangeOrContainer with the first N elements excluded.
unsigned Log2_32_Ceil(uint32_t Value)
Return the ceil log base 2 of the specified value, 32 if the value is zero.
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.
std::vector< UseListOrder > UseListOrderStack
auto reverse(ContainerTy &&C)
void sort(IteratorTy Start, IteratorTy End)
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...
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
static auto filterDbgVars(iterator_range< simple_ilist< DbgRecord >::iterator > R)
Filter the DbgRecord range to DbgVariableRecord types only and downcast.
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:...