#include "llvm/IR/AutoUpgrade.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/IR/AttributeMask.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InstVisitor.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/IntrinsicsAArch64.h"
#include "llvm/IR/IntrinsicsARM.h"
#include "llvm/IR/IntrinsicsNVPTX.h"
#include "llvm/IR/IntrinsicsRISCV.h"
#include "llvm/IR/IntrinsicsWebAssembly.h"
#include "llvm/IR/IntrinsicsX86.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Verifier.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Regex.h"
#include "llvm/TargetParser/Triple.h"
#include <cstring>
usingnamespacellvm;
static cl::opt<bool>
DisableAutoUpgradeDebugInfo("disable-auto-upgrade-debug-info",
cl::desc("Disable autoupgrade of debug info"));
static void rename(GlobalValue *GV) { … }
static bool upgradePTESTIntrinsic(Function *F, Intrinsic::ID IID,
Function *&NewFn) { … }
static bool upgradeX86IntrinsicsWith8BitMask(Function *F, Intrinsic::ID IID,
Function *&NewFn) { … }
static bool upgradeX86MaskedFPCompare(Function *F, Intrinsic::ID IID,
Function *&NewFn) { … }
static bool upgradeX86BF16Intrinsic(Function *F, Intrinsic::ID IID,
Function *&NewFn) { … }
static bool upgradeX86BF16DPIntrinsic(Function *F, Intrinsic::ID IID,
Function *&NewFn) { … }
static bool shouldUpgradeX86Intrinsic(Function *F, StringRef Name) { … }
static bool upgradeX86IntrinsicFunction(Function *F, StringRef Name,
Function *&NewFn) { … }
static bool upgradeArmOrAarch64IntrinsicFunction(bool IsArm, Function *F,
StringRef Name,
Function *&NewFn) { … }
static Intrinsic::ID shouldUpgradeNVPTXBF16Intrinsic(StringRef Name) { … }
static bool upgradeIntrinsicFunction1(Function *F, Function *&NewFn,
bool CanUpgradeDebugIntrinsicsToRecords) { … }
bool llvm::UpgradeIntrinsicFunction(Function *F, Function *&NewFn,
bool CanUpgradeDebugIntrinsicsToRecords) { … }
GlobalVariable *llvm::UpgradeGlobalVariable(GlobalVariable *GV) { … }
static Value *upgradeX86PSLLDQIntrinsics(IRBuilder<> &Builder, Value *Op,
unsigned Shift) { … }
static Value *upgradeX86PSRLDQIntrinsics(IRBuilder<> &Builder, Value *Op,
unsigned Shift) { … }
static Value *getX86MaskVec(IRBuilder<> &Builder, Value *Mask,
unsigned NumElts) { … }
static Value *emitX86Select(IRBuilder<> &Builder, Value *Mask, Value *Op0,
Value *Op1) { … }
static Value *emitX86ScalarSelect(IRBuilder<> &Builder, Value *Mask, Value *Op0,
Value *Op1) { … }
static Value *upgradeX86ALIGNIntrinsics(IRBuilder<> &Builder, Value *Op0,
Value *Op1, Value *Shift,
Value *Passthru, Value *Mask,
bool IsVALIGN) { … }
static Value *upgradeX86VPERMT2Intrinsics(IRBuilder<> &Builder, CallBase &CI,
bool ZeroMask, bool IndexForm) { … }
static Value *upgradeX86BinaryIntrinsics(IRBuilder<> &Builder, CallBase &CI,
Intrinsic::ID IID) { … }
static Value *upgradeX86Rotate(IRBuilder<> &Builder, CallBase &CI,
bool IsRotateRight) { … }
static Value *upgradeX86vpcom(IRBuilder<> &Builder, CallBase &CI, unsigned Imm,
bool IsSigned) { … }
static Value *upgradeX86ConcatShift(IRBuilder<> &Builder, CallBase &CI,
bool IsShiftRight, bool ZeroMask) { … }
static Value *upgradeMaskedStore(IRBuilder<> &Builder, Value *Ptr, Value *Data,
Value *Mask, bool Aligned) { … }
static Value *upgradeMaskedLoad(IRBuilder<> &Builder, Value *Ptr,
Value *Passthru, Value *Mask, bool Aligned) { … }
static Value *upgradeAbs(IRBuilder<> &Builder, CallBase &CI) { … }
static Value *upgradePMULDQ(IRBuilder<> &Builder, CallBase &CI, bool IsSigned) { … }
static Value *applyX86MaskOn1BitsVec(IRBuilder<> &Builder, Value *Vec,
Value *Mask) { … }
static Value *upgradeMaskedCompare(IRBuilder<> &Builder, CallBase &CI,
unsigned CC, bool Signed) { … }
static Value *upgradeX86MaskedShift(IRBuilder<> &Builder, CallBase &CI,
Intrinsic::ID IID) { … }
static Value *upgradeMaskedMove(IRBuilder<> &Builder, CallBase &CI) { … }
static Value *upgradeMaskToInt(IRBuilder<> &Builder, CallBase &CI) { … }
static bool upgradeAVX512MaskToSelect(StringRef Name, IRBuilder<> &Builder,
CallBase &CI, Value *&Rep) { … }
void llvm::UpgradeInlineAsmString(std::string *AsmStr) { … }
static Value *upgradeNVVMIntrinsicCall(StringRef Name, CallBase *CI,
Function *F, IRBuilder<> &Builder) { … }
static Value *upgradeX86IntrinsicCall(StringRef Name, CallBase *CI, Function *F,
IRBuilder<> &Builder) { … }
static Value *upgradeAArch64IntrinsicCall(StringRef Name, CallBase *CI,
Function *F, IRBuilder<> &Builder) { … }
static Value *upgradeARMIntrinsicCall(StringRef Name, CallBase *CI, Function *F,
IRBuilder<> &Builder) { … }
static Value *upgradeAMDGCNIntrinsicCall(StringRef Name, CallBase *CI,
Function *F, IRBuilder<> &Builder) { … }
template <typename MDType>
static MDType *unwrapMAVOp(CallBase *CI, unsigned Op) { … }
static void upgradeDbgIntrinsicToDbgRecord(StringRef Name, CallBase *CI) { … }
void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) { … }
void llvm::UpgradeCallsToIntrinsic(Function *F) { … }
MDNode *llvm::UpgradeTBAANode(MDNode &MD) { … }
Instruction *llvm::UpgradeBitCastInst(unsigned Opc, Value *V, Type *DestTy,
Instruction *&Temp) { … }
Constant *llvm::UpgradeBitCastExpr(unsigned Opc, Constant *C, Type *DestTy) { … }
bool llvm::UpgradeDebugInfo(Module &M) { … }
static bool upgradeRetainReleaseMarker(Module &M) { … }
void llvm::UpgradeARCRuntime(Module &M) { … }
bool llvm::UpgradeModuleFlags(Module &M) { … }
void llvm::UpgradeSectionAttributes(Module &M) { … }
namespace {
struct StrictFPUpgradeVisitor : public InstVisitor<StrictFPUpgradeVisitor> { … };
struct AMDGPUUnsafeFPAtomicsUpgradeVisitor
: public InstVisitor<AMDGPUUnsafeFPAtomicsUpgradeVisitor> { … };
}
void llvm::UpgradeFunctionAttributes(Function &F) { … }
static bool isOldLoopArgument(Metadata *MD) { … }
static MDString *upgradeLoopTag(LLVMContext &C, StringRef OldTag) { … }
static Metadata *upgradeLoopArgument(Metadata *MD) { … }
MDNode *llvm::upgradeInstructionLoopAttachment(MDNode &N) { … }
std::string llvm::UpgradeDataLayoutString(StringRef DL, StringRef TT) { … }
void llvm::UpgradeAttributes(AttrBuilder &B) { … }
void llvm::UpgradeOperandBundles(std::vector<OperandBundleDef> &Bundles) { … }