48#define DEBUG_TYPE "value-mapper" 
   51void ValueMapTypeRemapper::anchor() {}
 
   52void ValueMaterializer::anchor() {}
 
   58struct DelayedBasicBlock {
 
   60  std::unique_ptr<BasicBlock> TempBB;
 
   62  DelayedBasicBlock(
const BlockAddress &Old)
 
   63      : OldBB(Old.getBasicBlock()),
 
   78  struct AppendingGVTy {
 
   82  struct AliasOrIFuncTy {
 
   89  unsigned AppendingGVIsOldCtorDtor : 1;
 
   90  unsigned AppendingGVNumNewMembers;
 
   93    AppendingGVTy AppendingGV;
 
   94    AliasOrIFuncTy AliasOrIFunc;
 
   99struct MappingContext {
 
  101  ValueMaterializer *Materializer = 
nullptr;
 
  105                          ValueMaterializer *Materializer = 
nullptr)
 
  106      : VM(&VM), Materializer(Materializer) {}
 
  110  friend class MDNodeMapper;
 
  113  DenseSet<GlobalValue *> AlreadyScheduled;
 
  117  ValueMapTypeRemapper *TypeMapper;
 
  118  unsigned CurrentMCID = 0;
 
  127         ValueMapTypeRemapper *TypeMapper, ValueMaterializer *Materializer,
 
  130        MCs(1, MappingContext(VM, Materializer)), IdentityMD(IdentityMD) {}
 
  133  ~Mapper() { 
assert(!hasWorkToDo() && 
"Expected to be flushed"); }
 
  135  bool hasWorkToDo()
 const { 
return !Worklist.
empty(); }
 
  139                                  ValueMaterializer *Materializer = 
nullptr) {
 
  140    MCs.
push_back(MappingContext(VM, Materializer));
 
  141    return MCs.
size() - 1;
 
  146  void remapGlobalObjectMetadata(GlobalObject &GO);
 
  149  void remapInstruction(Instruction *
I);
 
  150  void remapFunction(Function &
F);
 
  151  void remapDbgRecord(DbgRecord &DVR);
 
  153  Constant *mapConstant(
const Constant *
C) {
 
  163  void scheduleMapGlobalInitializer(GlobalVariable &GV, Constant &Init,
 
  165  void scheduleMapAppendingVariable(GlobalVariable &GV, Constant *InitPrefix,
 
  169  void scheduleMapAliasOrIFunc(GlobalValue &GV, Constant &Target,
 
  171  void scheduleRemapFunction(Function &
F, 
unsigned MCID);
 
  176  void mapAppendingVariable(GlobalVariable &GV, Constant *InitPrefix,
 
  181  ValueMaterializer *getMaterializer() { 
return MCs[CurrentMCID].Materializer; }
 
  183  Value *mapBlockAddress(
const BlockAddress &BA);
 
  186  std::optional<Metadata *> mapSimpleMetadata(
const Metadata *MD);
 
  197    bool HasChanged = 
false;
 
  198    unsigned ID = std::numeric_limits<unsigned>::max();
 
  199    TempMDNode Placeholder;
 
  203  struct UniquedGraph {
 
  204    SmallDenseMap<const Metadata *, Data, 32> 
Info; 
 
  211    void propagateChanges();
 
  221  SmallDenseMap<const Metadata *, Data, 32> InfoStorage;
 
  225  MDNodeMapper(Mapper &M) : 
M(
M) {}
 
  267  Metadata *mapTopLevelUniquedNode(
const MDNode &FirstN);
 
  278  std::optional<Metadata *> tryToMapOperand(
const Metadata *
Op);
 
  287  MDNode *mapDistinctNode(
const MDNode &
N);
 
  306  bool createPOT(UniquedGraph &
G, 
const MDNode &FirstN);
 
  327  void mapNodesInPOT(UniquedGraph &
G);
 
  335  template <
class OperandMapper>
 
  345  if (
I != getVM().
end()) {
 
  346    assert(
I->second && 
"Unexpected null mapping");
 
  351  if (
auto *Materializer = getMaterializer()) {
 
  352    if (
Value *NewV = Materializer->materialize(
const_cast<Value *
>(V))) {
 
  363    return getVM()[
V] = 
const_cast<Value *
>(
V);
 
  372      if (NewTy != 
IA->getFunctionType())
 
  374                           IA->hasSideEffects(), 
IA->isAlignStack(),
 
  375                           IA->getDialect(), 
IA->canThrow());
 
  378    return getVM()[
V] = 
const_cast<Value *
>(
V);
 
  382    const Metadata *MD = MDV->getMetadata();
 
  386      if (
Value *LV = mapValue(
LAM->getValue())) {
 
  387        if (V == 
LAM->getValue())
 
  388          return const_cast<Value *
>(
V);
 
  401      for (
auto *VAM : 
AL->getArgs()) {
 
  409        } 
else if (
Value *LV = mapValue(VAM->getValue())) {
 
  427      return getVM()[
V] = 
const_cast<Value *
>(
V);
 
  430    auto *MappedMD = mapMetadata(MD);
 
  432      return getVM()[
V] = 
const_cast<Value *
>(
V);
 
  443    return mapBlockAddress(*BA);
 
  446    auto *Val = mapValue(
E->getGlobalValue());
 
  452    Type *NewTy = 
E->getType();
 
  460    auto *Val = mapValue(
NC->getGlobalValue());
 
  465  auto mapValueOrNull = [
this](
Value *
V) {
 
  466    auto Mapped = mapValue(V);
 
  468           "Unexpected null mapping for constant operand without " 
  469           "NullMapMissingGlobalValues flag");
 
  475  unsigned OpNo = 0, NumOperands = 
C->getNumOperands();
 
  476  Value *Mapped = 
nullptr;
 
  477  for (; OpNo != NumOperands; ++OpNo) {
 
  479    Mapped = mapValueOrNull(
Op);
 
  487  Type *NewTy = 
C->getType();
 
  493  if (OpNo == NumOperands && NewTy == 
C->getType())
 
  494    return getVM()[
V] = 
C;
 
  500  for (
unsigned j = 0; 
j != OpNo; ++
j)
 
  504  if (OpNo != NumOperands) {
 
  508    for (++OpNo; OpNo != NumOperands; ++OpNo) {
 
  509      Mapped = mapValueOrNull(
C->getOperand(OpNo));
 
  515  Type *NewSrcTy = 
nullptr;
 
  518      NewSrcTy = TypeMapper->
remapType(GEPO->getSourceElementType());
 
  521    return getVM()[
V] = 
CE->getWithOperands(
Ops, NewTy, 
false, NewSrcTy);
 
  544void Mapper::remapDbgRecord(
DbgRecord &DR) {
 
  557  auto *MappedVar = mapMetadata(
V.getVariable());
 
  562  if (
V.isDbgAssign()) {
 
  563    auto *NewAddr = mapValue(
V.getAddress());
 
  564    if (!IgnoreMissingLocals && !NewAddr)
 
  567      V.setAddress(NewAddr);
 
  574  for (
Value *Val : Vals)
 
  587    for (
unsigned int I = 0; 
I < Vals.size(); ++
I)
 
  589        V.replaceVariableLocationOp(
I, NewVals[
I]);
 
  601    DelayedBBs.
push_back(DelayedBasicBlock(BA));
 
  602    BB = DelayedBBs.
back().TempBB.get();
 
  611  getVM().MD()[
Key].reset(Val);
 
  616  return mapToMetadata(MD, 
const_cast<Metadata *
>(MD));
 
  619std::optional<Metadata *> MDNodeMapper::tryToMapOperand(
const Metadata *
Op) {
 
  623  if (std::optional<Metadata *> MappedOp = 
M.mapSimpleMetadata(
Op)) {
 
  626      assert((!*MappedOp || 
M.getVM().count(CMD->getValue()) ||
 
  627              M.getVM().getMappedMD(
Op)) &&
 
  628             "Expected Value to be memoized");
 
  631             "Expected result to be memoized");
 
  638    return mapDistinctNode(
N);
 
  643  assert(
N.isDistinct() && 
"Expected a distinct node");
 
  644  assert(!
M.getVM().getMappedMD(&
N) && 
"Expected an unmapped node");
 
  648    NewM = 
M.mapToSelf(&
N);
 
  652                      << 
"To  " << *NewM << 
"\n\n");
 
  653    M.mapToMetadata(&
N, NewM);
 
  657  return DistinctWorklist.back();
 
  667std::optional<Metadata *> MDNodeMapper::getMappedOp(
const Metadata *
Op)
 const {
 
  671  if (std::optional<Metadata *> MappedOp = 
M.getVM().getMappedMD(
Op))
 
  684  auto Where = 
Info.find(&
Op);
 
  685  assert(Where != 
Info.end() && 
"Expected a valid reference");
 
  687  auto &OpD = Where->second;
 
  692  if (!OpD.Placeholder)
 
  693    OpD.Placeholder = 
Op.clone();
 
  695  return *OpD.Placeholder;
 
  698template <
class OperandMapper>
 
  699void MDNodeMapper::remapOperands(
MDNode &
N, OperandMapper mapOperand) {
 
  700  assert(!
N.isUniqued() && 
"Expected distinct or temporary nodes");
 
  701  for (
unsigned I = 0, 
E = 
N.getNumOperands(); 
I != 
E; ++
I) {
 
  705      LLVM_DEBUG(
dbgs() << 
"Replacing Op " << Old << 
" with " << New << 
" in " 
  709      N.replaceOperandWith(
I, New);
 
  716struct POTWorklistEntry {
 
  722  bool HasChanged = 
false;
 
  724  POTWorklistEntry(MDNode &
N) : 
N(&
N), 
Op(
N.op_begin()) {}
 
  729bool MDNodeMapper::createPOT(UniquedGraph &
G, 
const MDNode &FirstN) {
 
  730  assert(
G.Info.empty() && 
"Expected a fresh traversal");
 
  734  bool AnyChanges = 
false;
 
  737  (void)
G.Info[&FirstN];
 
  738  while (!Worklist.
empty()) {
 
  740    auto &WE = Worklist.
back();
 
  741    if (
MDNode *
N = visitOperands(
G, WE.Op, WE.N->op_end(), WE.HasChanged)) {
 
  748    assert(WE.N->isUniqued() && 
"Expected only uniqued nodes");
 
  749    assert(WE.Op == WE.N->op_end() && 
"Expected to visit all operands");
 
  750    auto &
D = 
G.Info[WE.N];
 
  751    AnyChanges |= 
D.HasChanged = WE.HasChanged;
 
  753    G.POT.push_back(WE.N);
 
  765    if (std::optional<Metadata *> MappedOp = tryToMapOperand(
Op)) {
 
  767      HasChanged |= 
Op != *MappedOp;
 
  774           "Only uniqued operands cannot be mapped immediately");
 
  775    if (
G.Info.try_emplace(&OpN).second)
 
  781void MDNodeMapper::UniquedGraph::propagateChanges() {
 
  791            auto Where = Info.find(Op);
 
  792            return Where != Info.end() && Where->second.HasChanged;
 
  796      AnyChanges = 
D.HasChanged = 
true;
 
  798  } 
while (AnyChanges);
 
  801void MDNodeMapper::mapNodesInPOT(UniquedGraph &
G) {
 
  804  for (
auto *
N : 
G.POT) {
 
  813    bool HadPlaceholder(
D.Placeholder);
 
  816    TempMDNode ClonedN = 
D.Placeholder ? std::move(
D.Placeholder) : 
N->clone();
 
  818      if (std::optional<Metadata *> MappedOp = 
getMappedOp(Old))
 
  821      assert(
G.Info[Old].ID > 
D.ID && 
"Expected a forward reference");
 
  826    if (
N && NewN && 
N != NewN) {
 
  828                        << 
"To  " << *NewN << 
"\n\n");
 
  831    M.mapToMetadata(
N, NewN);
 
  840  for (
auto *
N : CyclicNodes)
 
  841    if (!
N->isResolved())
 
  846  assert(DistinctWorklist.empty() && 
"MDNodeMapper::map is not recursive");
 
  848         "MDNodeMapper::map assumes module-level changes");
 
  851  assert(
N.isResolved() && 
"Unexpected unresolved node");
 
  854      N.isUniqued() ? mapTopLevelUniquedNode(
N) : mapDistinctNode(
N);
 
  855  while (!DistinctWorklist.empty())
 
  857      if (std::optional<Metadata *> MappedOp = tryToMapOperand(Old))
 
  859      return mapTopLevelUniquedNode(*cast<MDNode>(Old));
 
  864Metadata *MDNodeMapper::mapTopLevelUniquedNode(
const MDNode &FirstN) {
 
  869  if (!createPOT(
G, FirstN)) {
 
  873    return &
const_cast<MDNode &
>(FirstN);
 
  877  G.propagateChanges();
 
  886std::optional<Metadata *> Mapper::mapSimpleMetadata(
const Metadata *MD) {
 
  888  if (std::optional<Metadata *> NewMD = getVM().getMappedMD(MD))
 
  910  if (IdentityMD && (*IdentityMD)(MD))
 
  919  assert(MD && 
"Expected valid metadata");
 
  922  if (std::optional<Metadata *> NewMD = mapSimpleMetadata(MD))
 
  928void Mapper::flush() {
 
  930  while (!Worklist.
empty()) {
 
  932    CurrentMCID = 
E.MCID;
 
  934    case WorklistEntry::MapGlobalInit:
 
  935      E.Data.GVInit.GV->setInitializer(mapConstant(
E.Data.GVInit.Init));
 
  936      remapGlobalObjectMetadata(*
E.Data.GVInit.GV);
 
  938    case WorklistEntry::MapAppendingVar: {
 
  939      unsigned PrefixSize = AppendingInits.
size() - 
E.AppendingGVNumNewMembers;
 
  945      AppendingInits.
resize(PrefixSize);
 
  946      mapAppendingVariable(*
E.Data.AppendingGV.GV,
 
  947                           E.Data.AppendingGV.InitPrefix,
 
  948                           E.AppendingGVIsOldCtorDtor, 
ArrayRef(NewInits));
 
  951    case WorklistEntry::MapAliasOrIFunc: {
 
  962    case WorklistEntry::RemapFunction:
 
  963      remapFunction(*
E.Data.RemapF);
 
  971  while (!DelayedBBs.
empty()) {
 
  974    DBB.TempBB->replaceAllUsesWith(BB ? BB : DBB.OldBB);
 
  980  for (
Use &
Op : 
I->operands()) {
 
  987             "Referenced value not in value map!");
 
  993    if (CB->getMetadata(LLVMContext::MD_callee_type) && !CB->isIndirectCall())
 
  994      CB->setMetadata(LLVMContext::MD_callee_type, 
nullptr);
 
  999    for (
unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) {
 
 1000      Value *
V = mapValue(PN->getIncomingBlock(i));
 
 1006               "Referenced block not in value map!");
 
 1012  I->getAllMetadata(MDs);
 
 1013  for (
const auto &
MI : MDs) {
 
 1017      I->setMetadata(
MI.first, New);
 
 1031    Tys.
reserve(FTy->getNumParams());
 
 1032    for (
Type *Ty : FTy->params())
 
 1035        TypeMapper->
remapType(
I->getType()), Tys, FTy->isVarArg()));
 
 1038    AttributeList 
Attrs = CB->getAttributes();
 
 1039    for (
unsigned i = 0; i < 
Attrs.getNumAttrSets(); ++i) {
 
 1040      for (
int AttrIdx = Attribute::FirstTypeAttr;
 
 1041           AttrIdx <= Attribute::LastTypeAttr; AttrIdx++) {
 
 1044                Attrs.getAttributeAtIndex(i, TypedAttr).getValueAsType()) {
 
 1045          Attrs = 
Attrs.replaceAttributeTypeAtIndex(
C, i, TypedAttr,
 
 1051    CB->setAttributes(Attrs);
 
 1055    AI->setAllocatedType(TypeMapper->
remapType(AI->getAllocatedType()));
 
 1057    GEP->setSourceElementType(
 
 1059    GEP->setResultElementType(
 
 1062  I->mutateType(TypeMapper->
remapType(
I->getType()));
 
 1065void Mapper::remapGlobalObjectMetadata(
GlobalObject &GO) {
 
 1069  for (
const auto &
I : MDs)
 
 1073void Mapper::remapFunction(
Function &
F) {
 
 1075  for (
Use &
Op : 
F.operands())
 
 1080  remapGlobalObjectMetadata(
F);
 
 1090      remapInstruction(&
I);
 
 1102    unsigned NumElements =
 
 1104    for (
unsigned I = 0; 
I != NumElements; ++
I)
 
 1110  if (IsOldCtorDtor) {
 
 1115    Type *Tys[3] = {
ST.getElementType(0), 
ST.getElementType(1), VoidPtrTy};
 
 1119  for (
auto *V : NewMembers) {
 
 1121    if (IsOldCtorDtor) {
 
 1139  assert(AlreadyScheduled.
insert(&GV).second && 
"Should not reschedule");
 
 1143  WE.Kind = WorklistEntry::MapGlobalInit;
 
 1145  WE.Data.GVInit.GV = &GV;
 
 1146  WE.Data.GVInit.Init = &
Init;
 
 1155  assert(AlreadyScheduled.
insert(&GV).second && 
"Should not reschedule");
 
 1159  WE.Kind = WorklistEntry::MapAppendingVar;
 
 1161  WE.Data.AppendingGV.GV = &GV;
 
 1162  WE.Data.AppendingGV.InitPrefix = InitPrefix;
 
 1163  WE.AppendingGVIsOldCtorDtor = IsOldCtorDtor;
 
 1164  WE.AppendingGVNumNewMembers = NewMembers.
size();
 
 1171  assert(AlreadyScheduled.
insert(&GV).second && 
"Should not reschedule");
 
 1173         "Should be alias or ifunc");
 
 1177  WE.Kind = WorklistEntry::MapAliasOrIFunc;
 
 1179  WE.Data.AliasOrIFunc.GV = &GV;
 
 1180  WE.Data.AliasOrIFunc.Target = &
Target;
 
 1184void Mapper::scheduleRemapFunction(
Function &
F, 
unsigned MCID) {
 
 1185  assert(AlreadyScheduled.
insert(&
F).second && 
"Should not reschedule");
 
 1189  WE.Kind = WorklistEntry::RemapFunction;
 
 1191  WE.Data.RemapF = &
F;
 
 1196  assert(!hasWorkToDo() && 
"Expected to have flushed the worklist");
 
 1201  return reinterpret_cast<Mapper *
>(pImpl);
 
 
 1206class FlushingMapper {
 
 1210  explicit FlushingMapper(
void *pImpl) : 
M(*
getAsMapper(pImpl)) {
 
 1211    assert(!
M.hasWorkToDo() && 
"Expected to be flushed");
 
 1214  ~FlushingMapper() { 
M.flush(); }
 
 1216  Mapper *operator->()
 const { 
return &
M; }
 
 1225    : pImpl(new Mapper(VM, Flags, TypeMapper, Materializer, IdentityMD)) {}
 
 
 1232  return getAsMapper(pImpl)->registerAlternateMappingContext(VM, Materializer);
 
 
 1236  FlushingMapper(pImpl)->addFlags(Flags);
 
 
 1240  return FlushingMapper(pImpl)->mapValue(&V);
 
 
 1248  return FlushingMapper(pImpl)->mapMetadata(&MD);
 
 
 1256  FlushingMapper(pImpl)->remapInstruction(&
I);
 
 
 1260  FlushingMapper(pImpl)->remapDbgRecord(DR);
 
 
 1271  FlushingMapper(pImpl)->remapFunction(
F);
 
 
 1275  FlushingMapper(pImpl)->remapGlobalObjectMetadata(GO);
 
 
 1290      GV, InitPrefix, IsOldCtorDtor, NewMembers, 
MCID);
 
 
 1312  auto AtomGroup = 
DL->getAtomGroup();
 
 1316  auto R = VM.
AtomMap.find({
DL->getInlinedAt(), AtomGroup});
 
 1319  AtomGroup = R->second;
 
 1323      I->getContext(), 
DL.getLine(), 
DL.getCol(), 
DL.getScope(),
 
 1324      DL.getInlinedAt(), 
DL.isImplicitCode(), AtomGroup, 
DL->getAtomRank());
 
 1325  I->setDebugLoc(New);
 
 
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
 
static unsigned getMappedOp(unsigned PseudoOp)
 
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
 
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
 
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
 
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
 
Analysis containing CSE Info
 
This file contains the declarations for the subclasses of Constant, which represent the different fla...
 
This file defines the DenseMap class.
 
This file defines the DenseSet and SmallDenseSet classes.
 
This file contains the declaration of the GlobalIFunc class, which represents a single indirect funct...
 
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
 
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
 
This file defines the SmallVector class.
 
static void remapOperands(VPBlockBase *Entry, VPBlockBase *NewEntry, DenseMap< VPValue *, VPValue * > &Old2NewVPValues)
 
static Mapper * getAsMapper(void *pImpl)
 
static ConstantAsMetadata * wrapConstantAsMetadata(const ConstantAsMetadata &CMD, Value *MappedV)
 
This class represents an incoming formal argument to a Function.
 
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
 
const T & front() const
front - Get the first element.
 
size_t size() const
size - Get the array size.
 
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
 
LLVM Basic Block Representation.
 
The address of a basic block.
 
Function * getFunction() const
 
BasicBlock * getBasicBlock() const
 
static LLVM_ABI BlockAddress * get(Function *F, BasicBlock *BB)
Return a BlockAddress for the specified function and basic block.
 
static LLVM_ABI ConstantAggregateZero * get(Type *Ty)
 
static LLVM_ABI Constant * get(ArrayType *T, ArrayRef< Constant * > V)
 
A constant value that is initialized with an expression using other constant values.
 
static LLVM_ABI Constant * getBitCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)
 
static LLVM_ABI ConstantPointerNull * get(PointerType *T)
Static factory methods - Return objects of the specified value.
 
static LLVM_ABI ConstantPtrAuth * get(Constant *Ptr, ConstantInt *Key, ConstantInt *Disc, Constant *AddrDisc)
Return a pointer signed with the specified parameters.
 
static LLVM_ABI Constant * get(StructType *T, ArrayRef< Constant * > V)
 
static LLVM_ABI Constant * get(ArrayRef< Constant * > V)
 
This is an important base class in LLVM.
 
static LLVM_ABI Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
 
LLVM_ABI Constant * getAggregateElement(unsigned Elt) const
For aggregates (struct/array/vector) return the constant that corresponds to the specified element if...
 
static LLVM_ABI DIArgList * get(LLVMContext &Context, ArrayRef< ValueAsMetadata * > Args)
 
static LLVM_ABI DSOLocalEquivalent * get(GlobalValue *GV)
Return a DSOLocalEquivalent for the specified global value.
 
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
 
void setDebugLoc(DebugLoc Loc)
 
Record of a variable value-assignment, aka a non instruction representation of the dbg....
 
Class to represent function types.
 
static LLVM_ABI FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
 
LLVM_ABI void getAllMetadata(SmallVectorImpl< std::pair< unsigned, MDNode * > > &MDs) const
Appends all metadata attached to this value to MDs, sorting by KindID.
 
LLVM_ABI void addMetadata(unsigned KindID, MDNode &MD)
Add a metadata attachment.
 
LLVM_ABI void clearMetadata()
Erase all metadata attached to this Value.
 
Type * getValueType() const
 
LLVM_ABI void setInitializer(Constant *InitVal)
setInitializer - Sets the initializer for this global variable, removing any existing initializer if ...
 
static LLVM_ABI InlineAsm * get(FunctionType *Ty, StringRef AsmString, StringRef Constraints, bool hasSideEffects, bool isAlignStack=false, AsmDialect asmDialect=AD_ATT, bool canThrow=false)
InlineAsm::get - Return the specified uniqued inline asm string.
 
This is an important class for using LLVM in a threaded context.
 
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
 
static std::enable_if_t< std::is_base_of< MDNode, T >::value, T * > replaceWithDistinct(std::unique_ptr< T, TempMDNodeDeleter > N)
Replace a temporary node with a distinct one.
 
const MDOperand * op_iterator
 
static std::enable_if_t< std::is_base_of< MDNode, T >::value, T * > replaceWithUniqued(std::unique_ptr< T, TempMDNodeDeleter > N)
Replace a temporary node with a uniqued one.
 
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
 
A Module instance is used to store all the information related to an LLVM module.
 
static LLVM_ABI NoCFIValue * get(GlobalValue *GV)
Return a NoCFIValue for the specified function.
 
Class to represent pointers.
 
static PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the default address space (address sp...
 
static LLVM_ABI PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
 
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
 
void reserve(size_type N)
 
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
 
void push_back(const T &Elt)
 
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
 
static LLVM_ABI StructType * get(LLVMContext &Context, ArrayRef< Type * > Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
 
Target - Wrapper for Target specific information.
 
Tracking metadata reference.
 
The instances of the Type class are immutable: once they are created, they are never changed.
 
static LLVM_ABI UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
 
A Use represents the edge between a Value definition and its users.
 
This is a class that can be implemented by clients to remap types when cloning constants and instruct...
 
virtual Type * remapType(Type *SrcTy)=0
The client should implement this method if they want to remap types while mapping values.
 
ValueMapIteratorImpl< MapT, const Value *, false > iterator
 
DMAtomT AtomMap
Map {(InlinedAt, old atom number) -> new atom number}.
 
LLVM_ABI void remapDbgRecord(Module *M, DbgRecord &V)
 
LLVM_ABI void remapDbgRecordRange(Module *M, iterator_range< DbgRecordIterator > Range)
 
LLVM_ABI MDNode * mapMDNode(const MDNode &N)
 
LLVM_ABI Metadata * mapMetadata(const Metadata &MD)
 
LLVM_ABI void remapInstruction(Instruction &I)
 
LLVM_ABI void scheduleMapGlobalInitializer(GlobalVariable &GV, Constant &Init, unsigned MappingContextID=0)
 
LLVM_ABI void scheduleRemapFunction(Function &F, unsigned MappingContextID=0)
 
LLVM_ABI ValueMapper(ValueToValueMapTy &VM, RemapFlags Flags=RF_None, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr, const MetadataPredicate *IdentityMD=nullptr)
 
LLVM_ABI void scheduleMapGlobalIFunc(GlobalIFunc &GI, Constant &Resolver, unsigned MappingContextID=0)
 
LLVM_ABI unsigned registerAlternateMappingContext(ValueToValueMapTy &VM, ValueMaterializer *Materializer=nullptr)
Register an alternate mapping context.
 
LLVM_ABI void remapFunction(Function &F)
 
LLVM_ABI Constant * mapConstant(const Constant &C)
 
LLVM_ABI void scheduleMapAppendingVariable(GlobalVariable &GV, Constant *InitPrefix, bool IsOldCtorDtor, ArrayRef< Constant * > NewMembers, unsigned MappingContextID=0)
 
LLVM_ABI void scheduleMapGlobalAlias(GlobalAlias &GA, Constant &Aliasee, unsigned MappingContextID=0)
 
LLVM_ABI void remapGlobalObjectMetadata(GlobalObject &GO)
 
LLVM_ABI Value * mapValue(const Value &V)
 
LLVM_ABI void addFlags(RemapFlags Flags)
Add to the current RemapFlags.
 
This is a class that can be implemented by clients to materialize Values on demand.
 
LLVM Value Representation.
 
Type * getType() const
All values are typed, get the type of this value.
 
LLVM_ABI LLVMContext & getContext() const
All values hold a context through their type.
 
std::pair< iterator, bool > insert(const ValueT &V)
 
A range adaptor for a pair of iterators.
 
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
 
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
 
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
 
@ C
The default llvm calling convention, compatible with C.
 
@ BasicBlock
Various leaf nodes.
 
@ CE
Windows NT (Windows on ARM)
 
NodeAddr< FuncNode * > Func
 
Context & getContext() const
 
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.
 
FunctionAddr VTableAddr Value
 
std::function< bool(const Metadata *)> MetadataPredicate
 
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
 
auto cast_or_null(const Y &Val)
 
RemapFlags
These are flags that the value mapping APIs allow.
 
@ RF_IgnoreMissingLocals
If this flag is set, the remapper ignores missing function-local entries (Argument,...
 
@ RF_NullMapMissingGlobalValues
Any global values not in value map are mapped to null instead of mapping to self.
 
@ RF_NoModuleLevelChanges
If this flag is set, the remapper knows that only local values within a function (such as an instruct...
 
@ RF_DoNotRemapAtoms
Do not remap source location atoms.
 
@ RF_ReuseAndMutateDistinctMDs
Instruct the remapper to reuse and mutate distinct metadata (remapping them in place) instead of clon...
 
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
 
bool none_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::none_of which take ranges instead of having to pass begin/end explicitly.
 
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
 
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
 
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
 
FunctionAddr VTableAddr uintptr_t uintptr_t Data
 
DWARFExpression::Operation Op
 
ArrayRef(const T &OneElt) -> ArrayRef< T >
 
ValueMap< const Value *, WeakTrackingVH > ValueToValueMapTy
 
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
 
void RemapFunction(Function &F, ValueToValueMapTy &VM, RemapFlags Flags=RF_None, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr, const MetadataPredicate *IdentityMD=nullptr)
Remap the operands, metadata, arguments, and instructions of a function.
 
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
 
LLVM_ABI void RemapSourceAtom(Instruction *I, ValueToValueMapTy &VM)
Remap source location atom.