llvm/llvm/lib/IR/Instructions.cpp

//===- Instructions.cpp - Implement the LLVM instructions -----------------===//
//
// 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 implements all of the non-inline methods for the LLVM instruction
// classes.
//
//===----------------------------------------------------------------------===//

#include "llvm/IR/Instructions.h"
#include "LLVMContextImpl.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Twine.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/ConstantRange.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/MDBuilder.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/ProfDataUtils.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/AtomicOrdering.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CheckedArithmetic.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/ModRef.h"
#include "llvm/Support/TypeSize.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <optional>
#include <vector>

usingnamespacellvm;

static cl::opt<bool> DisableI2pP2iOpt(
    "disable-i2p-p2i-opt", cl::init(false),
    cl::desc("Disables inttoptr/ptrtoint roundtrip optimization"));

//===----------------------------------------------------------------------===//
//                            AllocaInst Class
//===----------------------------------------------------------------------===//

std::optional<TypeSize>
AllocaInst::getAllocationSize(const DataLayout &DL) const {}

std::optional<TypeSize>
AllocaInst::getAllocationSizeInBits(const DataLayout &DL) const {}

//===----------------------------------------------------------------------===//
//                              SelectInst Class
//===----------------------------------------------------------------------===//

/// areInvalidOperands - Return a string if the specified operands are invalid
/// for a select operation, otherwise return null.
const char *SelectInst::areInvalidOperands(Value *Op0, Value *Op1, Value *Op2) {}

//===----------------------------------------------------------------------===//
//                               PHINode Class
//===----------------------------------------------------------------------===//

PHINode::PHINode(const PHINode &PN)
    :{}

// removeIncomingValue - Remove an incoming value.  This is useful if a
// predecessor basic block is deleted.
Value *PHINode::removeIncomingValue(unsigned Idx, bool DeletePHIIfEmpty) {}

void PHINode::removeIncomingValueIf(function_ref<bool(unsigned)> Predicate,
                                    bool DeletePHIIfEmpty) {}

/// growOperands - grow operands - This grows the operand list in response
/// to a push_back style of operation.  This grows the number of ops by 1.5
/// times.
///
void PHINode::growOperands() {}

/// hasConstantValue - If the specified PHI node always merges together the same
/// value, return the value, otherwise return null.
Value *PHINode::hasConstantValue() const {}

/// hasConstantOrUndefValue - Whether the specified PHI node always merges
/// together the same value, assuming that undefs result in the same value as
/// non-undefs.
/// Unlike \ref hasConstantValue, this does not return a value because the
/// unique non-undef incoming value need not dominate the PHI node.
bool PHINode::hasConstantOrUndefValue() const {}

//===----------------------------------------------------------------------===//
//                       LandingPadInst Implementation
//===----------------------------------------------------------------------===//

LandingPadInst::LandingPadInst(Type *RetTy, unsigned NumReservedValues,
                               const Twine &NameStr,
                               InsertPosition InsertBefore)
    :{}

LandingPadInst::LandingPadInst(const LandingPadInst &LP)
    :{}

LandingPadInst *LandingPadInst::Create(Type *RetTy, unsigned NumReservedClauses,
                                       const Twine &NameStr,
                                       InsertPosition InsertBefore) {}

void LandingPadInst::init(unsigned NumReservedValues, const Twine &NameStr) {}

/// growOperands - grow operands - This grows the operand list in response to a
/// push_back style of operation. This grows the number of ops by 2 times.
void LandingPadInst::growOperands(unsigned Size) {}

void LandingPadInst::addClause(Constant *Val) {}

//===----------------------------------------------------------------------===//
//                        CallBase Implementation
//===----------------------------------------------------------------------===//

CallBase *CallBase::Create(CallBase *CB, ArrayRef<OperandBundleDef> Bundles,
                           InsertPosition InsertPt) {}

CallBase *CallBase::Create(CallBase *CI, OperandBundleDef OpB,
                           InsertPosition InsertPt) {}

Function *CallBase::getCaller() {}

unsigned CallBase::getNumSubclassExtraOperandsDynamic() const {}

bool CallBase::isIndirectCall() const {}

/// Tests if this call site must be tail call optimized. Only a CallInst can
/// be tail call optimized.
bool CallBase::isMustTailCall() const {}

/// Tests if this call site is marked as a tail call.
bool CallBase::isTailCall() const {}

Intrinsic::ID CallBase::getIntrinsicID() const {}

FPClassTest CallBase::getRetNoFPClass() const {}

FPClassTest CallBase::getParamNoFPClass(unsigned i) const {}

std::optional<ConstantRange> CallBase::getRange() const {}

bool CallBase::isReturnNonNull() const {}

Value *CallBase::getArgOperandWithAttribute(Attribute::AttrKind Kind) const {}

/// Determine whether the argument or parameter has the given attribute.
bool CallBase::paramHasAttr(unsigned ArgNo, Attribute::AttrKind Kind) const {}

bool CallBase::hasFnAttrOnCalledFunction(Attribute::AttrKind Kind) const {}

bool CallBase::hasFnAttrOnCalledFunction(StringRef Kind) const {}

template <typename AK>
Attribute CallBase::getFnAttrOnCalledFunction(AK Kind) const {}

template Attribute
CallBase::getFnAttrOnCalledFunction(Attribute::AttrKind Kind) const;
template Attribute CallBase::getFnAttrOnCalledFunction(StringRef Kind) const;

template <typename AK>
Attribute CallBase::getParamAttrOnCalledFunction(unsigned ArgNo,
                                                 AK Kind) const {}
template Attribute
CallBase::getParamAttrOnCalledFunction(unsigned ArgNo,
                                       Attribute::AttrKind Kind) const;
template Attribute CallBase::getParamAttrOnCalledFunction(unsigned ArgNo,
                                                          StringRef Kind) const;

void CallBase::getOperandBundlesAsDefs(
    SmallVectorImpl<OperandBundleDef> &Defs) const {}

CallBase::op_iterator
CallBase::populateBundleOperandInfos(ArrayRef<OperandBundleDef> Bundles,
                                     const unsigned BeginIndex) {}

CallBase::BundleOpInfo &CallBase::getBundleOpInfoForOperand(unsigned OpIdx) {}

CallBase *CallBase::addOperandBundle(CallBase *CB, uint32_t ID,
                                     OperandBundleDef OB,
                                     InsertPosition InsertPt) {}

CallBase *CallBase::removeOperandBundle(CallBase *CB, uint32_t ID,
                                        InsertPosition InsertPt) {}

bool CallBase::hasReadingOperandBundles() const {}

bool CallBase::hasClobberingOperandBundles() const {}

MemoryEffects CallBase::getMemoryEffects() const {}
void CallBase::setMemoryEffects(MemoryEffects ME) {}

/// Determine if the function does not access memory.
bool CallBase::doesNotAccessMemory() const {}
void CallBase::setDoesNotAccessMemory() {}

/// Determine if the function does not access or only reads memory.
bool CallBase::onlyReadsMemory() const {}
void CallBase::setOnlyReadsMemory() {}

/// Determine if the function does not access or only writes memory.
bool CallBase::onlyWritesMemory() const {}
void CallBase::setOnlyWritesMemory() {}

/// Determine if the call can access memmory only using pointers based
/// on its arguments.
bool CallBase::onlyAccessesArgMemory() const {}
void CallBase::setOnlyAccessesArgMemory() {}

/// Determine if the function may only access memory that is
///  inaccessible from the IR.
bool CallBase::onlyAccessesInaccessibleMemory() const {}
void CallBase::setOnlyAccessesInaccessibleMemory() {}

/// Determine if the function may only access memory that is
///  either inaccessible from the IR or pointed to by its arguments.
bool CallBase::onlyAccessesInaccessibleMemOrArgMem() const {}
void CallBase::setOnlyAccessesInaccessibleMemOrArgMem() {}

//===----------------------------------------------------------------------===//
//                        CallInst Implementation
//===----------------------------------------------------------------------===//

void CallInst::init(FunctionType *FTy, Value *Func, ArrayRef<Value *> Args,
                    ArrayRef<OperandBundleDef> Bundles, const Twine &NameStr) {}

void CallInst::init(FunctionType *FTy, Value *Func, const Twine &NameStr) {}

CallInst::CallInst(FunctionType *Ty, Value *Func, const Twine &Name,
                   AllocInfo AllocInfo, InsertPosition InsertBefore)
    :{}

CallInst::CallInst(const CallInst &CI, AllocInfo AllocInfo)
    :{}

CallInst *CallInst::Create(CallInst *CI, ArrayRef<OperandBundleDef> OpB,
                           InsertPosition InsertPt) {}

// Update profile weight for call instruction by scaling it using the ratio
// of S/T. The meaning of "branch_weights" meta data for call instruction is
// transfered to represent call count.
void CallInst::updateProfWeight(uint64_t S, uint64_t T) {}

//===----------------------------------------------------------------------===//
//                        InvokeInst Implementation
//===----------------------------------------------------------------------===//

void InvokeInst::init(FunctionType *FTy, Value *Fn, BasicBlock *IfNormal,
                      BasicBlock *IfException, ArrayRef<Value *> Args,
                      ArrayRef<OperandBundleDef> Bundles,
                      const Twine &NameStr) {}

InvokeInst::InvokeInst(const InvokeInst &II, AllocInfo AllocInfo)
    :{}

InvokeInst *InvokeInst::Create(InvokeInst *II, ArrayRef<OperandBundleDef> OpB,
                               InsertPosition InsertPt) {}

LandingPadInst *InvokeInst::getLandingPadInst() const {}

void InvokeInst::updateProfWeight(uint64_t S, uint64_t T) {}

//===----------------------------------------------------------------------===//
//                        CallBrInst Implementation
//===----------------------------------------------------------------------===//

void CallBrInst::init(FunctionType *FTy, Value *Fn, BasicBlock *Fallthrough,
                      ArrayRef<BasicBlock *> IndirectDests,
                      ArrayRef<Value *> Args,
                      ArrayRef<OperandBundleDef> Bundles,
                      const Twine &NameStr) {}

CallBrInst::CallBrInst(const CallBrInst &CBI, AllocInfo AllocInfo)
    :{}

CallBrInst *CallBrInst::Create(CallBrInst *CBI, ArrayRef<OperandBundleDef> OpB,
                               InsertPosition InsertPt) {}

//===----------------------------------------------------------------------===//
//                        ReturnInst Implementation
//===----------------------------------------------------------------------===//

ReturnInst::ReturnInst(const ReturnInst &RI, AllocInfo AllocInfo)
    :{}

ReturnInst::ReturnInst(LLVMContext &C, Value *retVal, AllocInfo AllocInfo,
                       InsertPosition InsertBefore)
    :{}

//===----------------------------------------------------------------------===//
//                        ResumeInst Implementation
//===----------------------------------------------------------------------===//

ResumeInst::ResumeInst(const ResumeInst &RI)
    :{}

ResumeInst::ResumeInst(Value *Exn, InsertPosition InsertBefore)
    :{}

//===----------------------------------------------------------------------===//
//                        CleanupReturnInst Implementation
//===----------------------------------------------------------------------===//

CleanupReturnInst::CleanupReturnInst(const CleanupReturnInst &CRI,
                                     AllocInfo AllocInfo)
    :{}

void CleanupReturnInst::init(Value *CleanupPad, BasicBlock *UnwindBB) {}

CleanupReturnInst::CleanupReturnInst(Value *CleanupPad, BasicBlock *UnwindBB,
                                     AllocInfo AllocInfo,
                                     InsertPosition InsertBefore)
    :{}

//===----------------------------------------------------------------------===//
//                        CatchReturnInst Implementation
//===----------------------------------------------------------------------===//
void CatchReturnInst::init(Value *CatchPad, BasicBlock *BB) {}

CatchReturnInst::CatchReturnInst(const CatchReturnInst &CRI)
    :{}

CatchReturnInst::CatchReturnInst(Value *CatchPad, BasicBlock *BB,
                                 InsertPosition InsertBefore)
    :{}

//===----------------------------------------------------------------------===//
//                       CatchSwitchInst Implementation
//===----------------------------------------------------------------------===//

CatchSwitchInst::CatchSwitchInst(Value *ParentPad, BasicBlock *UnwindDest,
                                 unsigned NumReservedValues,
                                 const Twine &NameStr,
                                 InsertPosition InsertBefore)
    :{}

CatchSwitchInst::CatchSwitchInst(const CatchSwitchInst &CSI)
    :{}

void CatchSwitchInst::init(Value *ParentPad, BasicBlock *UnwindDest,
                           unsigned NumReservedValues) {}

/// growOperands - grow operands - This grows the operand list in response to a
/// push_back style of operation. This grows the number of ops by 2 times.
void CatchSwitchInst::growOperands(unsigned Size) {}

void CatchSwitchInst::addHandler(BasicBlock *Handler) {}

void CatchSwitchInst::removeHandler(handler_iterator HI) {}

//===----------------------------------------------------------------------===//
//                        FuncletPadInst Implementation
//===----------------------------------------------------------------------===//
void FuncletPadInst::init(Value *ParentPad, ArrayRef<Value *> Args,
                          const Twine &NameStr) {}

FuncletPadInst::FuncletPadInst(const FuncletPadInst &FPI, AllocInfo AllocInfo)
    :{}

FuncletPadInst::FuncletPadInst(Instruction::FuncletPadOps Op, Value *ParentPad,
                               ArrayRef<Value *> Args, AllocInfo AllocInfo,
                               const Twine &NameStr,
                               InsertPosition InsertBefore)
    :{}

//===----------------------------------------------------------------------===//
//                      UnreachableInst Implementation
//===----------------------------------------------------------------------===//

UnreachableInst::UnreachableInst(LLVMContext &Context,
                                 InsertPosition InsertBefore)
    :{}

//===----------------------------------------------------------------------===//
//                        BranchInst Implementation
//===----------------------------------------------------------------------===//

void BranchInst::AssertOK() {}

BranchInst::BranchInst(BasicBlock *IfTrue, AllocInfo AllocInfo,
                       InsertPosition InsertBefore)
    :{}

BranchInst::BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond,
                       AllocInfo AllocInfo, InsertPosition InsertBefore)
    :{}

BranchInst::BranchInst(const BranchInst &BI, AllocInfo AllocInfo)
    :{}

void BranchInst::swapSuccessors() {}

//===----------------------------------------------------------------------===//
//                        AllocaInst Implementation
//===----------------------------------------------------------------------===//

static Value *getAISize(LLVMContext &Context, Value *Amt) {}

static Align computeAllocaDefaultAlign(Type *Ty, InsertPosition Pos) {}

AllocaInst::AllocaInst(Type *Ty, unsigned AddrSpace, const Twine &Name,
                       InsertPosition InsertBefore)
    :{}

AllocaInst::AllocaInst(Type *Ty, unsigned AddrSpace, Value *ArraySize,
                       const Twine &Name, InsertPosition InsertBefore)
    :{}

AllocaInst::AllocaInst(Type *Ty, unsigned AddrSpace, Value *ArraySize,
                       Align Align, const Twine &Name,
                       InsertPosition InsertBefore)
    :{}

bool AllocaInst::isArrayAllocation() const {}

/// isStaticAlloca - Return true if this alloca is in the entry block of the
/// function and is a constant size.  If so, the code generator will fold it
/// into the prolog/epilog code, so it is basically free.
bool AllocaInst::isStaticAlloca() const {}

//===----------------------------------------------------------------------===//
//                           LoadInst Implementation
//===----------------------------------------------------------------------===//

void LoadInst::AssertOK() {}

static Align computeLoadStoreDefaultAlign(Type *Ty, InsertPosition Pos) {}

LoadInst::LoadInst(Type *Ty, Value *Ptr, const Twine &Name,
                   InsertPosition InsertBef)
    :{}

LoadInst::LoadInst(Type *Ty, Value *Ptr, const Twine &Name, bool isVolatile,
                   InsertPosition InsertBef)
    :{}

LoadInst::LoadInst(Type *Ty, Value *Ptr, const Twine &Name, bool isVolatile,
                   Align Align, InsertPosition InsertBef)
    :{}

LoadInst::LoadInst(Type *Ty, Value *Ptr, const Twine &Name, bool isVolatile,
                   Align Align, AtomicOrdering Order, SyncScope::ID SSID,
                   InsertPosition InsertBef)
    :{}

//===----------------------------------------------------------------------===//
//                           StoreInst Implementation
//===----------------------------------------------------------------------===//

void StoreInst::AssertOK() {}

StoreInst::StoreInst(Value *val, Value *addr, InsertPosition InsertBefore)
    :{}

StoreInst::StoreInst(Value *val, Value *addr, bool isVolatile,
                     InsertPosition InsertBefore)
    :{}

StoreInst::StoreInst(Value *val, Value *addr, bool isVolatile, Align Align,
                     InsertPosition InsertBefore)
    :{}

StoreInst::StoreInst(Value *val, Value *addr, bool isVolatile, Align Align,
                     AtomicOrdering Order, SyncScope::ID SSID,
                     InsertPosition InsertBefore)
    :{}

//===----------------------------------------------------------------------===//
//                       AtomicCmpXchgInst Implementation
//===----------------------------------------------------------------------===//

void AtomicCmpXchgInst::Init(Value *Ptr, Value *Cmp, Value *NewVal,
                             Align Alignment, AtomicOrdering SuccessOrdering,
                             AtomicOrdering FailureOrdering,
                             SyncScope::ID SSID) {}

AtomicCmpXchgInst::AtomicCmpXchgInst(Value *Ptr, Value *Cmp, Value *NewVal,
                                     Align Alignment,
                                     AtomicOrdering SuccessOrdering,
                                     AtomicOrdering FailureOrdering,
                                     SyncScope::ID SSID,
                                     InsertPosition InsertBefore)
    :{}

//===----------------------------------------------------------------------===//
//                       AtomicRMWInst Implementation
//===----------------------------------------------------------------------===//

void AtomicRMWInst::Init(BinOp Operation, Value *Ptr, Value *Val,
                         Align Alignment, AtomicOrdering Ordering,
                         SyncScope::ID SSID) {}

AtomicRMWInst::AtomicRMWInst(BinOp Operation, Value *Ptr, Value *Val,
                             Align Alignment, AtomicOrdering Ordering,
                             SyncScope::ID SSID, InsertPosition InsertBefore)
    :{}

StringRef AtomicRMWInst::getOperationName(BinOp Op) {}

//===----------------------------------------------------------------------===//
//                       FenceInst Implementation
//===----------------------------------------------------------------------===//

FenceInst::FenceInst(LLVMContext &C, AtomicOrdering Ordering,
                     SyncScope::ID SSID, InsertPosition InsertBefore)
    :{}

//===----------------------------------------------------------------------===//
//                       GetElementPtrInst Implementation
//===----------------------------------------------------------------------===//

void GetElementPtrInst::init(Value *Ptr, ArrayRef<Value *> IdxList,
                             const Twine &Name) {}

GetElementPtrInst::GetElementPtrInst(const GetElementPtrInst &GEPI,
                                     AllocInfo AllocInfo)
    :{}

Type *GetElementPtrInst::getTypeAtIndex(Type *Ty, Value *Idx) {}

Type *GetElementPtrInst::getTypeAtIndex(Type *Ty, uint64_t Idx) {}

template <typename IndexTy>
static Type *getIndexedTypeInternal(Type *Ty, ArrayRef<IndexTy> IdxList) {}

Type *GetElementPtrInst::getIndexedType(Type *Ty, ArrayRef<Value *> IdxList) {}

Type *GetElementPtrInst::getIndexedType(Type *Ty,
                                        ArrayRef<Constant *> IdxList) {}

Type *GetElementPtrInst::getIndexedType(Type *Ty, ArrayRef<uint64_t> IdxList) {}

/// hasAllZeroIndices - Return true if all of the indices of this GEP are
/// zeros.  If so, the result pointer and the first operand have the same
/// value, just potentially different types.
bool GetElementPtrInst::hasAllZeroIndices() const {}

/// hasAllConstantIndices - Return true if all of the indices of this GEP are
/// constant integers.  If so, the result pointer and the first operand have
/// a constant offset between them.
bool GetElementPtrInst::hasAllConstantIndices() const {}

void GetElementPtrInst::setNoWrapFlags(GEPNoWrapFlags NW) {}

void GetElementPtrInst::setIsInBounds(bool B) {}

GEPNoWrapFlags GetElementPtrInst::getNoWrapFlags() const {}

bool GetElementPtrInst::isInBounds() const {}

bool GetElementPtrInst::hasNoUnsignedSignedWrap() const {}

bool GetElementPtrInst::hasNoUnsignedWrap() const {}

bool GetElementPtrInst::accumulateConstantOffset(const DataLayout &DL,
                                                 APInt &Offset) const {}

bool GetElementPtrInst::collectOffset(
    const DataLayout &DL, unsigned BitWidth,
    MapVector<Value *, APInt> &VariableOffsets,
    APInt &ConstantOffset) const {}

//===----------------------------------------------------------------------===//
//                           ExtractElementInst Implementation
//===----------------------------------------------------------------------===//

ExtractElementInst::ExtractElementInst(Value *Val, Value *Index,
                                       const Twine &Name,
                                       InsertPosition InsertBef)
    :{}

bool ExtractElementInst::isValidOperands(const Value *Val, const Value *Index) {}

//===----------------------------------------------------------------------===//
//                           InsertElementInst Implementation
//===----------------------------------------------------------------------===//

InsertElementInst::InsertElementInst(Value *Vec, Value *Elt, Value *Index,
                                     const Twine &Name,
                                     InsertPosition InsertBef)
    :{}

bool InsertElementInst::isValidOperands(const Value *Vec, const Value *Elt,
                                        const Value *Index) {}

//===----------------------------------------------------------------------===//
//                      ShuffleVectorInst Implementation
//===----------------------------------------------------------------------===//

static Value *createPlaceholderForShuffleVector(Value *V) {}

ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *Mask, const Twine &Name,
                                     InsertPosition InsertBefore)
    :{}

ShuffleVectorInst::ShuffleVectorInst(Value *V1, ArrayRef<int> Mask,
                                     const Twine &Name,
                                     InsertPosition InsertBefore)
    :{}

ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
                                     const Twine &Name,
                                     InsertPosition InsertBefore)
    :{}

ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *V2, ArrayRef<int> Mask,
                                     const Twine &Name,
                                     InsertPosition InsertBefore)
    :{}

void ShuffleVectorInst::commute() {}

bool ShuffleVectorInst::isValidOperands(const Value *V1, const Value *V2,
                                        ArrayRef<int> Mask) {}

bool ShuffleVectorInst::isValidOperands(const Value *V1, const Value *V2,
                                        const Value *Mask) {}

void ShuffleVectorInst::getShuffleMask(const Constant *Mask,
                                       SmallVectorImpl<int> &Result) {}

void ShuffleVectorInst::setShuffleMask(ArrayRef<int> Mask) {}

Constant *ShuffleVectorInst::convertShuffleMaskForBitcode(ArrayRef<int> Mask,
                                                          Type *ResultTy) {}

static bool isSingleSourceMaskImpl(ArrayRef<int> Mask, int NumOpElts) {}

bool ShuffleVectorInst::isSingleSourceMask(ArrayRef<int> Mask, int NumSrcElts) {}

static bool isIdentityMaskImpl(ArrayRef<int> Mask, int NumOpElts) {}

bool ShuffleVectorInst::isIdentityMask(ArrayRef<int> Mask, int NumSrcElts) {}

bool ShuffleVectorInst::isReverseMask(ArrayRef<int> Mask, int NumSrcElts) {}

bool ShuffleVectorInst::isZeroEltSplatMask(ArrayRef<int> Mask, int NumSrcElts) {}

bool ShuffleVectorInst::isSelectMask(ArrayRef<int> Mask, int NumSrcElts) {}

bool ShuffleVectorInst::isTransposeMask(ArrayRef<int> Mask, int NumSrcElts) {}

bool ShuffleVectorInst::isSpliceMask(ArrayRef<int> Mask, int NumSrcElts,
                                     int &Index) {}

bool ShuffleVectorInst::isExtractSubvectorMask(ArrayRef<int> Mask,
                                               int NumSrcElts, int &Index) {}

bool ShuffleVectorInst::isInsertSubvectorMask(ArrayRef<int> Mask,
                                              int NumSrcElts, int &NumSubElts,
                                              int &Index) {}

bool ShuffleVectorInst::isIdentityWithPadding() const {}

bool ShuffleVectorInst::isIdentityWithExtract() const {}

bool ShuffleVectorInst::isConcat() const {}

static bool isReplicationMaskWithParams(ArrayRef<int> Mask,
                                        int ReplicationFactor, int VF) {}

bool ShuffleVectorInst::isReplicationMask(ArrayRef<int> Mask,
                                          int &ReplicationFactor, int &VF) {}

bool ShuffleVectorInst::isReplicationMask(int &ReplicationFactor,
                                          int &VF) const {}

bool ShuffleVectorInst::isOneUseSingleSourceMask(ArrayRef<int> Mask, int VF) {}

/// Return true if this shuffle mask is a replication mask.
bool ShuffleVectorInst::isOneUseSingleSourceMask(int VF) const {}

bool ShuffleVectorInst::isInterleave(unsigned Factor) {}

bool ShuffleVectorInst::isInterleaveMask(
    ArrayRef<int> Mask, unsigned Factor, unsigned NumInputElts,
    SmallVectorImpl<unsigned> &StartIndexes) {}

/// Check if the mask is a DE-interleave mask of the given factor
/// \p Factor like:
///     <Index, Index+Factor, ..., Index+(NumElts-1)*Factor>
bool ShuffleVectorInst::isDeInterleaveMaskOfFactor(ArrayRef<int> Mask,
                                                   unsigned Factor,
                                                   unsigned &Index) {}

/// Try to lower a vector shuffle as a bit rotation.
///
/// Look for a repeated rotation pattern in each sub group.
/// Returns an element-wise left bit rotation amount or -1 if failed.
static int matchShuffleAsBitRotate(ArrayRef<int> Mask, int NumSubElts) {}

bool ShuffleVectorInst::isBitRotateMask(
    ArrayRef<int> Mask, unsigned EltSizeInBits, unsigned MinSubElts,
    unsigned MaxSubElts, unsigned &NumSubElts, unsigned &RotateAmt) {}

//===----------------------------------------------------------------------===//
//                             InsertValueInst Class
//===----------------------------------------------------------------------===//

void InsertValueInst::init(Value *Agg, Value *Val, ArrayRef<unsigned> Idxs,
                           const Twine &Name) {}

InsertValueInst::InsertValueInst(const InsertValueInst &IVI)
    :{}

//===----------------------------------------------------------------------===//
//                             ExtractValueInst Class
//===----------------------------------------------------------------------===//

void ExtractValueInst::init(ArrayRef<unsigned> Idxs, const Twine &Name) {}

ExtractValueInst::ExtractValueInst(const ExtractValueInst &EVI)
    :{}

// getIndexedType - Returns the type of the element that would be extracted
// with an extractvalue instruction with the specified parameters.
//
// A null type is returned if the indices are invalid for the specified
// pointer type.
//
Type *ExtractValueInst::getIndexedType(Type *Agg,
                                       ArrayRef<unsigned> Idxs) {}

//===----------------------------------------------------------------------===//
//                             UnaryOperator Class
//===----------------------------------------------------------------------===//

UnaryOperator::UnaryOperator(UnaryOps iType, Value *S, Type *Ty,
                             const Twine &Name, InsertPosition InsertBefore)
    :{}

UnaryOperator *UnaryOperator::Create(UnaryOps Op, Value *S, const Twine &Name,
                                     InsertPosition InsertBefore) {}

void UnaryOperator::AssertOK() {}

//===----------------------------------------------------------------------===//
//                             BinaryOperator Class
//===----------------------------------------------------------------------===//

BinaryOperator::BinaryOperator(BinaryOps iType, Value *S1, Value *S2, Type *Ty,
                               const Twine &Name, InsertPosition InsertBefore)
    :{}

void BinaryOperator::AssertOK() {}

BinaryOperator *BinaryOperator::Create(BinaryOps Op, Value *S1, Value *S2,
                                       const Twine &Name,
                                       InsertPosition InsertBefore) {}

BinaryOperator *BinaryOperator::CreateNeg(Value *Op, const Twine &Name,
                                          InsertPosition InsertBefore) {}

BinaryOperator *BinaryOperator::CreateNSWNeg(Value *Op, const Twine &Name,
                                             InsertPosition InsertBefore) {}

BinaryOperator *BinaryOperator::CreateNot(Value *Op, const Twine &Name,
                                          InsertPosition InsertBefore) {}

// Exchange the two operands to this instruction. This instruction is safe to
// use on any binary instruction and does not modify the semantics of the
// instruction. If the instruction is order-dependent (SetLT f.e.), the opcode
// is changed.
bool BinaryOperator::swapOperands() {}

//===----------------------------------------------------------------------===//
//                             FPMathOperator Class
//===----------------------------------------------------------------------===//

float FPMathOperator::getFPAccuracy() const {}

//===----------------------------------------------------------------------===//
//                                CastInst Class
//===----------------------------------------------------------------------===//

// Just determine if this cast only deals with integral->integral conversion.
bool CastInst::isIntegerCast() const {}

/// This function determines if the CastInst does not require any bits to be
/// changed in order to effect the cast. Essentially, it identifies cases where
/// no code gen is necessary for the cast, hence the name no-op cast.  For
/// example, the following are all no-op casts:
/// # bitcast i32* %x to i8*
/// # bitcast <2 x i32> %x to <4 x i16>
/// # ptrtoint i32* %x to i32     ; on 32-bit plaforms only
/// Determine if the described cast is a no-op.
bool CastInst::isNoopCast(Instruction::CastOps Opcode,
                          Type *SrcTy,
                          Type *DestTy,
                          const DataLayout &DL) {}

bool CastInst::isNoopCast(const DataLayout &DL) const {}

/// This function determines if a pair of casts can be eliminated and what
/// opcode should be used in the elimination. This assumes that there are two
/// instructions like this:
/// *  %F = firstOpcode SrcTy %x to MidTy
/// *  %S = secondOpcode MidTy %F to DstTy
/// The function returns a resultOpcode so these two casts can be replaced with:
/// *  %Replacement = resultOpcode %SrcTy %x to DstTy
/// If no such cast is permitted, the function returns 0.
unsigned CastInst::isEliminableCastPair(
  Instruction::CastOps firstOp, Instruction::CastOps secondOp,
  Type *SrcTy, Type *MidTy, Type *DstTy, Type *SrcIntPtrTy, Type *MidIntPtrTy,
  Type *DstIntPtrTy) {}

CastInst *CastInst::Create(Instruction::CastOps op, Value *S, Type *Ty,
                           const Twine &Name, InsertPosition InsertBefore) {}

CastInst *CastInst::CreateZExtOrBitCast(Value *S, Type *Ty, const Twine &Name,
                                        InsertPosition InsertBefore) {}

CastInst *CastInst::CreateSExtOrBitCast(Value *S, Type *Ty, const Twine &Name,
                                        InsertPosition InsertBefore) {}

CastInst *CastInst::CreateTruncOrBitCast(Value *S, Type *Ty, const Twine &Name,
                                         InsertPosition InsertBefore) {}

/// Create a BitCast or a PtrToInt cast instruction
CastInst *CastInst::CreatePointerCast(Value *S, Type *Ty, const Twine &Name,
                                      InsertPosition InsertBefore) {}

CastInst *CastInst::CreatePointerBitCastOrAddrSpaceCast(
    Value *S, Type *Ty, const Twine &Name, InsertPosition InsertBefore) {}

CastInst *CastInst::CreateBitOrPointerCast(Value *S, Type *Ty,
                                           const Twine &Name,
                                           InsertPosition InsertBefore) {}

CastInst *CastInst::CreateIntegerCast(Value *C, Type *Ty, bool isSigned,
                                      const Twine &Name,
                                      InsertPosition InsertBefore) {}

CastInst *CastInst::CreateFPCast(Value *C, Type *Ty, const Twine &Name,
                                 InsertPosition InsertBefore) {}

bool CastInst::isBitCastable(Type *SrcTy, Type *DestTy) {}

bool CastInst::isBitOrNoopPointerCastable(Type *SrcTy, Type *DestTy,
                                          const DataLayout &DL) {}

// Provide a way to get a "cast" where the cast opcode is inferred from the
// types and size of the operand. This, basically, is a parallel of the
// logic in the castIsValid function below.  This axiom should hold:
//   castIsValid( getCastOpcode(Val, Ty), Val, Ty)
// should not assert in castIsValid. In other words, this produces a "correct"
// casting opcode for the arguments passed to it.
Instruction::CastOps
CastInst::getCastOpcode(
  const Value *Src, bool SrcIsSigned, Type *DestTy, bool DestIsSigned) {}

//===----------------------------------------------------------------------===//
//                    CastInst SubClass Constructors
//===----------------------------------------------------------------------===//

/// Check that the construction parameters for a CastInst are correct. This
/// could be broken out into the separate constructors but it is useful to have
/// it in one place and to eliminate the redundant code for getting the sizes
/// of the types involved.
bool
CastInst::castIsValid(Instruction::CastOps op, Type *SrcTy, Type *DstTy) {}

TruncInst::TruncInst(Value *S, Type *Ty, const Twine &Name,
                     InsertPosition InsertBefore)
    :{}

ZExtInst::ZExtInst(Value *S, Type *Ty, const Twine &Name,
                   InsertPosition InsertBefore)
    :{}

SExtInst::SExtInst(Value *S, Type *Ty, const Twine &Name,
                   InsertPosition InsertBefore)
    :{}

FPTruncInst::FPTruncInst(Value *S, Type *Ty, const Twine &Name,
                         InsertPosition InsertBefore)
    :{}

FPExtInst::FPExtInst(Value *S, Type *Ty, const Twine &Name,
                     InsertPosition InsertBefore)
    :{}

UIToFPInst::UIToFPInst(Value *S, Type *Ty, const Twine &Name,
                       InsertPosition InsertBefore)
    :{}

SIToFPInst::SIToFPInst(Value *S, Type *Ty, const Twine &Name,
                       InsertPosition InsertBefore)
    :{}

FPToUIInst::FPToUIInst(Value *S, Type *Ty, const Twine &Name,
                       InsertPosition InsertBefore)
    :{}

FPToSIInst::FPToSIInst(Value *S, Type *Ty, const Twine &Name,
                       InsertPosition InsertBefore)
    :{}

PtrToIntInst::PtrToIntInst(Value *S, Type *Ty, const Twine &Name,
                           InsertPosition InsertBefore)
    :{}

IntToPtrInst::IntToPtrInst(Value *S, Type *Ty, const Twine &Name,
                           InsertPosition InsertBefore)
    :{}

BitCastInst::BitCastInst(Value *S, Type *Ty, const Twine &Name,
                         InsertPosition InsertBefore)
    :{}

AddrSpaceCastInst::AddrSpaceCastInst(Value *S, Type *Ty, const Twine &Name,
                                     InsertPosition InsertBefore)
    :{}

//===----------------------------------------------------------------------===//
//                               CmpInst Classes
//===----------------------------------------------------------------------===//

CmpInst::CmpInst(Type *ty, OtherOps op, Predicate predicate, Value *LHS,
                 Value *RHS, const Twine &Name, InsertPosition InsertBefore,
                 Instruction *FlagsSource)
    :{}

CmpInst *CmpInst::Create(OtherOps Op, Predicate predicate, Value *S1, Value *S2,
                         const Twine &Name, InsertPosition InsertBefore) {}

CmpInst *CmpInst::CreateWithCopiedFlags(OtherOps Op, Predicate Pred, Value *S1,
                                        Value *S2,
                                        const Instruction *FlagsSource,
                                        const Twine &Name,
                                        InsertPosition InsertBefore) {}

void CmpInst::swapOperands() {}

bool CmpInst::isCommutative() const {}

bool CmpInst::isEquality(Predicate P) {}

CmpInst::Predicate CmpInst::getInversePredicate(Predicate pred) {}

StringRef CmpInst::getPredicateName(Predicate Pred) {}

raw_ostream &llvm::operator<<(raw_ostream &OS, CmpInst::Predicate Pred) {}

ICmpInst::Predicate ICmpInst::getSignedPredicate(Predicate pred) {}

ICmpInst::Predicate ICmpInst::getUnsignedPredicate(Predicate pred) {}

CmpInst::Predicate CmpInst::getSwappedPredicate(Predicate pred) {}

bool CmpInst::isNonStrictPredicate(Predicate pred) {}

bool CmpInst::isStrictPredicate(Predicate pred) {}

CmpInst::Predicate CmpInst::getStrictPredicate(Predicate pred) {}

CmpInst::Predicate CmpInst::getNonStrictPredicate(Predicate pred) {}

CmpInst::Predicate CmpInst::getFlippedStrictnessPredicate(Predicate pred) {}

CmpInst::Predicate CmpInst::getSignedPredicate(Predicate pred) {}

CmpInst::Predicate CmpInst::getUnsignedPredicate(Predicate pred) {}

bool CmpInst::isUnsigned(Predicate predicate) {}

bool CmpInst::isSigned(Predicate predicate) {}

bool ICmpInst::compare(const APInt &LHS, const APInt &RHS,
                       ICmpInst::Predicate Pred) {}

bool FCmpInst::compare(const APFloat &LHS, const APFloat &RHS,
                       FCmpInst::Predicate Pred) {}

CmpInst::Predicate CmpInst::getFlippedSignednessPredicate(Predicate pred) {}

bool CmpInst::isOrdered(Predicate predicate) {}

bool CmpInst::isUnordered(Predicate predicate) {}

bool CmpInst::isTrueWhenEqual(Predicate predicate) {}

bool CmpInst::isFalseWhenEqual(Predicate predicate) {}

bool CmpInst::isImpliedTrueByMatchingCmp(Predicate Pred1, Predicate Pred2) {}

bool CmpInst::isImpliedFalseByMatchingCmp(Predicate Pred1, Predicate Pred2) {}

//===----------------------------------------------------------------------===//
//                        SwitchInst Implementation
//===----------------------------------------------------------------------===//

void SwitchInst::init(Value *Value, BasicBlock *Default, unsigned NumReserved) {}

/// SwitchInst ctor - Create a new switch instruction, specifying a value to
/// switch on and a default destination.  The number of additional cases can
/// be specified here to make memory allocation more efficient.  This
/// constructor can also autoinsert before another instruction.
SwitchInst::SwitchInst(Value *Value, BasicBlock *Default, unsigned NumCases,
                       InsertPosition InsertBefore)
    :{}

SwitchInst::SwitchInst(const SwitchInst &SI)
    :{}

/// addCase - Add an entry to the switch instruction...
///
void SwitchInst::addCase(ConstantInt *OnVal, BasicBlock *Dest) {}

/// removeCase - This method removes the specified case and its successor
/// from the switch instruction.
SwitchInst::CaseIt SwitchInst::removeCase(CaseIt I) {}

/// growOperands - grow operands - This grows the operand list in response
/// to a push_back style of operation.  This grows the number of ops by 3 times.
///
void SwitchInst::growOperands() {}

MDNode *SwitchInstProfUpdateWrapper::buildProfBranchWeightsMD() {}

void SwitchInstProfUpdateWrapper::init() {}

SwitchInst::CaseIt
SwitchInstProfUpdateWrapper::removeCase(SwitchInst::CaseIt I) {}

void SwitchInstProfUpdateWrapper::addCase(
    ConstantInt *OnVal, BasicBlock *Dest,
    SwitchInstProfUpdateWrapper::CaseWeightOpt W) {}

Instruction::InstListType::iterator
SwitchInstProfUpdateWrapper::eraseFromParent() {}

SwitchInstProfUpdateWrapper::CaseWeightOpt
SwitchInstProfUpdateWrapper::getSuccessorWeight(unsigned idx) {}

void SwitchInstProfUpdateWrapper::setSuccessorWeight(
    unsigned idx, SwitchInstProfUpdateWrapper::CaseWeightOpt W) {}

SwitchInstProfUpdateWrapper::CaseWeightOpt
SwitchInstProfUpdateWrapper::getSuccessorWeight(const SwitchInst &SI,
                                                unsigned idx) {}

//===----------------------------------------------------------------------===//
//                        IndirectBrInst Implementation
//===----------------------------------------------------------------------===//

void IndirectBrInst::init(Value *Address, unsigned NumDests) {}


/// growOperands - grow operands - This grows the operand list in response
/// to a push_back style of operation.  This grows the number of ops by 2 times.
///
void IndirectBrInst::growOperands() {}

IndirectBrInst::IndirectBrInst(Value *Address, unsigned NumCases,
                               InsertPosition InsertBefore)
    :{}

IndirectBrInst::IndirectBrInst(const IndirectBrInst &IBI)
    :{}

/// addDestination - Add a destination.
///
void IndirectBrInst::addDestination(BasicBlock *DestBB) {}

/// removeDestination - This method removes the specified successor from the
/// indirectbr instruction.
void IndirectBrInst::removeDestination(unsigned idx) {}

//===----------------------------------------------------------------------===//
//                            FreezeInst Implementation
//===----------------------------------------------------------------------===//

FreezeInst::FreezeInst(Value *S, const Twine &Name, InsertPosition InsertBefore)
    :{}

//===----------------------------------------------------------------------===//
//                           cloneImpl() implementations
//===----------------------------------------------------------------------===//

// Define these methods here so vtables don't get emitted into every translation
// unit that uses these classes.

GetElementPtrInst *GetElementPtrInst::cloneImpl() const {}

UnaryOperator *UnaryOperator::cloneImpl() const {}

BinaryOperator *BinaryOperator::cloneImpl() const {}

FCmpInst *FCmpInst::cloneImpl() const {}

ICmpInst *ICmpInst::cloneImpl() const {}

ExtractValueInst *ExtractValueInst::cloneImpl() const {}

InsertValueInst *InsertValueInst::cloneImpl() const {}

AllocaInst *AllocaInst::cloneImpl() const {}

LoadInst *LoadInst::cloneImpl() const {}

StoreInst *StoreInst::cloneImpl() const {}

AtomicCmpXchgInst *AtomicCmpXchgInst::cloneImpl() const {}

AtomicRMWInst *AtomicRMWInst::cloneImpl() const {}

FenceInst *FenceInst::cloneImpl() const {}

TruncInst *TruncInst::cloneImpl() const {}

ZExtInst *ZExtInst::cloneImpl() const {}

SExtInst *SExtInst::cloneImpl() const {}

FPTruncInst *FPTruncInst::cloneImpl() const {}

FPExtInst *FPExtInst::cloneImpl() const {}

UIToFPInst *UIToFPInst::cloneImpl() const {}

SIToFPInst *SIToFPInst::cloneImpl() const {}

FPToUIInst *FPToUIInst::cloneImpl() const {}

FPToSIInst *FPToSIInst::cloneImpl() const {}

PtrToIntInst *PtrToIntInst::cloneImpl() const {}

IntToPtrInst *IntToPtrInst::cloneImpl() const {}

BitCastInst *BitCastInst::cloneImpl() const {}

AddrSpaceCastInst *AddrSpaceCastInst::cloneImpl() const {}

CallInst *CallInst::cloneImpl() const {}

SelectInst *SelectInst::cloneImpl() const {}

VAArgInst *VAArgInst::cloneImpl() const {}

ExtractElementInst *ExtractElementInst::cloneImpl() const {}

InsertElementInst *InsertElementInst::cloneImpl() const {}

ShuffleVectorInst *ShuffleVectorInst::cloneImpl() const {}

PHINode *PHINode::cloneImpl() const {}

LandingPadInst *LandingPadInst::cloneImpl() const {}

ReturnInst *ReturnInst::cloneImpl() const {}

BranchInst *BranchInst::cloneImpl() const {}

SwitchInst *SwitchInst::cloneImpl() const {}

IndirectBrInst *IndirectBrInst::cloneImpl() const {}

InvokeInst *InvokeInst::cloneImpl() const {}

CallBrInst *CallBrInst::cloneImpl() const {}

ResumeInst *ResumeInst::cloneImpl() const {}

CleanupReturnInst *CleanupReturnInst::cloneImpl() const {}

CatchReturnInst *CatchReturnInst::cloneImpl() const {}

CatchSwitchInst *CatchSwitchInst::cloneImpl() const {}

FuncletPadInst *FuncletPadInst::cloneImpl() const {}

UnreachableInst *UnreachableInst::cloneImpl() const {}

FreezeInst *FreezeInst::cloneImpl() const {}