llvm/llvm/lib/Transforms/Utils/ValueMapper.cpp

//===- ValueMapper.cpp - Interface shared by lib/Transforms/Utils ---------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file defines the MapValue function, which is shared by various parts of
// the lib/Transforms/Utils library.
//
//===----------------------------------------------------------------------===//

#include "llvm/Transforms/Utils/ValueMapper.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/GlobalIFunc.h"
#include "llvm/IR/GlobalObject.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Debug.h"
#include <cassert>
#include <limits>
#include <memory>
#include <utility>

usingnamespacellvm;

#define DEBUG_TYPE

// Out of line method to get vtable etc for class.
void ValueMapTypeRemapper::anchor() {}
void ValueMaterializer::anchor() {}

namespace {

/// A basic block used in a BlockAddress whose function body is not yet
/// materialized.
struct DelayedBasicBlock {};

struct WorklistEntry {};

struct MappingContext {};

class Mapper {};

class MDNodeMapper {};

} // end anonymous namespace

Value *Mapper::mapValue(const Value *V) {}

void Mapper::remapDbgRecord(DbgRecord &DR) {}

Value *Mapper::mapBlockAddress(const BlockAddress &BA) {}

Metadata *Mapper::mapToMetadata(const Metadata *Key, Metadata *Val) {}

Metadata *Mapper::mapToSelf(const Metadata *MD) {}

std::optional<Metadata *> MDNodeMapper::tryToMapOperand(const Metadata *Op) {}

MDNode *MDNodeMapper::mapDistinctNode(const MDNode &N) {}

static ConstantAsMetadata *wrapConstantAsMetadata(const ConstantAsMetadata &CMD,
                                                  Value *MappedV) {}

std::optional<Metadata *> MDNodeMapper::getMappedOp(const Metadata *Op) const {}

Metadata &MDNodeMapper::UniquedGraph::getFwdReference(MDNode &Op) {}

template <class OperandMapper>
void MDNodeMapper::remapOperands(MDNode &N, OperandMapper mapOperand) {}

namespace {

/// An entry in the worklist for the post-order traversal.
struct POTWorklistEntry {};

} // end anonymous namespace

bool MDNodeMapper::createPOT(UniquedGraph &G, const MDNode &FirstN) {}

MDNode *MDNodeMapper::visitOperands(UniquedGraph &G, MDNode::op_iterator &I,
                                    MDNode::op_iterator E, bool &HasChanged) {}

void MDNodeMapper::UniquedGraph::propagateChanges() {}

void MDNodeMapper::mapNodesInPOT(UniquedGraph &G) {}

Metadata *MDNodeMapper::map(const MDNode &N) {}

Metadata *MDNodeMapper::mapTopLevelUniquedNode(const MDNode &FirstN) {}

std::optional<Metadata *> Mapper::mapSimpleMetadata(const Metadata *MD) {}

Metadata *Mapper::mapMetadata(const Metadata *MD) {}

void Mapper::flush() {}

void Mapper::remapInstruction(Instruction *I) {}

void Mapper::remapGlobalObjectMetadata(GlobalObject &GO) {}

void Mapper::remapFunction(Function &F) {}

void Mapper::mapAppendingVariable(GlobalVariable &GV, Constant *InitPrefix,
                                  bool IsOldCtorDtor,
                                  ArrayRef<Constant *> NewMembers) {}

void Mapper::scheduleMapGlobalInitializer(GlobalVariable &GV, Constant &Init,
                                          unsigned MCID) {}

void Mapper::scheduleMapAppendingVariable(GlobalVariable &GV,
                                          Constant *InitPrefix,
                                          bool IsOldCtorDtor,
                                          ArrayRef<Constant *> NewMembers,
                                          unsigned MCID) {}

void Mapper::scheduleMapAliasOrIFunc(GlobalValue &GV, Constant &Target,
                                     unsigned MCID) {}

void Mapper::scheduleRemapFunction(Function &F, unsigned MCID) {}

void Mapper::addFlags(RemapFlags Flags) {}

static Mapper *getAsMapper(void *pImpl) {}

namespace {

class FlushingMapper {};

} // end anonymous namespace

ValueMapper::ValueMapper(ValueToValueMapTy &VM, RemapFlags Flags,
                         ValueMapTypeRemapper *TypeMapper,
                         ValueMaterializer *Materializer)
    :{}

ValueMapper::~ValueMapper() {}

unsigned
ValueMapper::registerAlternateMappingContext(ValueToValueMapTy &VM,
                                             ValueMaterializer *Materializer) {}

void ValueMapper::addFlags(RemapFlags Flags) {}

Value *ValueMapper::mapValue(const Value &V) {}

Constant *ValueMapper::mapConstant(const Constant &C) {}

Metadata *ValueMapper::mapMetadata(const Metadata &MD) {}

MDNode *ValueMapper::mapMDNode(const MDNode &N) {}

void ValueMapper::remapInstruction(Instruction &I) {}

void ValueMapper::remapDbgRecord(Module *M, DbgRecord &DR) {}

void ValueMapper::remapDbgRecordRange(
    Module *M, iterator_range<DbgRecord::self_iterator> Range) {}

void ValueMapper::remapFunction(Function &F) {}

void ValueMapper::remapGlobalObjectMetadata(GlobalObject &GO) {}

void ValueMapper::scheduleMapGlobalInitializer(GlobalVariable &GV,
                                               Constant &Init,
                                               unsigned MCID) {}

void ValueMapper::scheduleMapAppendingVariable(GlobalVariable &GV,
                                               Constant *InitPrefix,
                                               bool IsOldCtorDtor,
                                               ArrayRef<Constant *> NewMembers,
                                               unsigned MCID) {}

void ValueMapper::scheduleMapGlobalAlias(GlobalAlias &GA, Constant &Aliasee,
                                         unsigned MCID) {}

void ValueMapper::scheduleMapGlobalIFunc(GlobalIFunc &GI, Constant &Resolver,
                                         unsigned MCID) {}

void ValueMapper::scheduleRemapFunction(Function &F, unsigned MCID) {}