LLVM 20.0.0git
|
#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>
Go to the source code of this file.
Variables | |
static cl::opt< bool > | DisableAutoUpgradeDebugInfo ("disable-auto-upgrade-debug-info", cl::desc("Disable autoupgrade of debug info")) |
Definition at line 1914 of file AutoUpgrade.cpp.
References llvm::CallingConv::C, llvm::IRBuilderBase::CreateAnd(), llvm::IRBuilderBase::CreateBitCast(), llvm::IRBuilderBase::CreateShuffleVector(), llvm::IRBuilderBase::getIntNTy(), llvm::Constant::getNullValue(), llvm::Value::getType(), and getX86MaskVec().
Referenced by llvm::UpgradeIntrinsicCall(), upgradeMaskedCompare(), and upgradeX86IntrinsicCall().
|
static |
Definition at line 1591 of file AutoUpgrade.cpp.
References llvm::CallingConv::C, llvm::IRBuilderBase::CreateBitCast(), llvm::IRBuilderBase::CreateExtractElement(), llvm::IRBuilderBase::CreateSelect(), llvm::FixedVectorType::get(), and llvm::IRBuilderBase::getInt1Ty().
Referenced by upgradeX86IntrinsicCall().
|
static |
Definition at line 1579 of file AutoUpgrade.cpp.
References llvm::CallingConv::C, llvm::IRBuilderBase::CreateSelect(), llvm::Value::getType(), and getX86MaskVec().
Referenced by upgradeAbs(), upgradeAVX512MaskToSelect(), upgradePMULDQ(), upgradeX86ALIGNIntrinsics(), upgradeX86BinaryIntrinsics(), upgradeX86ConcatShift(), upgradeX86IntrinsicCall(), upgradeX86MaskedShift(), upgradeX86Rotate(), and upgradeX86VPERMT2Intrinsics().
Definition at line 1559 of file AutoUpgrade.cpp.
References assert(), llvm::IRBuilderBase::CreateBitCast(), llvm::IRBuilderBase::CreateShuffleVector(), llvm::FixedVectorType::get(), llvm::IntegerType::getBitWidth(), llvm::IRBuilderBase::getInt1Ty(), and llvm::isPowerOf2_32().
Referenced by applyX86MaskOn1BitsVec(), emitX86Select(), llvm::UpgradeIntrinsicCall(), upgradeMaskedLoad(), upgradeMaskedStore(), upgradeMaskToInt(), and upgradeX86IntrinsicCall().
Definition at line 5333 of file AutoUpgrade.cpp.
Referenced by llvm::upgradeInstructionLoopAttachment().
|
static |
Definition at line 52 of file AutoUpgrade.cpp.
References llvm::Value::getName(), and llvm::Value::setName().
Referenced by upgradeArmOrAarch64IntrinsicFunction(), llvm::UpgradeIntrinsicCall(), upgradeIntrinsicFunction1(), upgradePTESTIntrinsic(), upgradeX86BF16DPIntrinsic(), upgradeX86BF16Intrinsic(), upgradeX86IntrinsicFunction(), upgradeX86IntrinsicsWith8BitMask(), and upgradeX86MaskedFPCompare().
|
static |
Definition at line 918 of file AutoUpgrade.cpp.
References llvm::StringSwitch< T, R >::Case(), llvm::StringSwitch< T, R >::Default(), Name, and llvm::Intrinsic::not_intrinsic.
Referenced by llvm::UpgradeIntrinsicCall(), and upgradeIntrinsicFunction1().
Definition at line 119 of file AutoUpgrade.cpp.
References Name.
Referenced by upgradeX86IntrinsicFunction().
Helper to unwrap intrinsic call MetadataAsValue operands.
Definition at line 4112 of file AutoUpgrade.cpp.
References llvm::CallBase::getArgOperand().
Definition at line 1874 of file AutoUpgrade.cpp.
References llvm::CallBase::arg_size(), llvm::IRBuilderBase::CreateCall(), emitX86Select(), F, llvm::CallBase::getArgOperand(), llvm::Intrinsic::getDeclaration(), llvm::IRBuilderBase::getInt1(), llvm::Instruction::getModule(), and llvm::Value::getType().
Referenced by upgradeX86IntrinsicCall().
|
static |
Definition at line 4037 of file AutoUpgrade.cpp.
References llvm::IRBuilderBase::CreateAtomicRMW(), llvm::IRBuilderBase::CreateBitCast(), F, llvm::AtomicRMWInst::FAdd, llvm::AtomicRMWInst::FMax, llvm::AtomicRMWInst::FMin, llvm::MDNode::get(), llvm::CallBase::getArgOperand(), llvm::Type::getBFloatTy(), llvm::User::getNumOperands(), llvm::LLVMContext::getOrInsertSyncScopeID(), llvm::Value::getType(), llvm::ConstantInt::getZExtValue(), llvm::isValidAtomicOrdering(), llvm::ConstantInt::isZero(), Name, Ptr, RetTy, llvm::Instruction::setMetadata(), llvm::AtomicRMWInst::setVolatile(), llvm::StringSwitch< T, R >::StartsWith(), llvm::AtomicRMWInst::UDecWrap, and llvm::AtomicRMWInst::UIncWrap.
Referenced by llvm::UpgradeIntrinsicCall().
|
static |
Definition at line 3938 of file AutoUpgrade.cpp.
References llvm::CallBase::args(), llvm::IRBuilderBase::CreateCall(), F, llvm::FixedVectorType::get(), llvm::CallBase::getArgOperand(), llvm::Intrinsic::getDeclaration(), llvm::IRBuilderBase::getInt1Ty(), llvm::CallBase::getIntrinsicID(), llvm::Value::getName(), llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), llvm::Value::getType(), llvm_unreachable, and Name.
Referenced by llvm::UpgradeIntrinsicCall().
|
static |
Definition at line 626 of file AutoUpgrade.cpp.
References assert(), llvm::StringSwitch< T, R >::Case(), llvm::StringSwitch< T, R >::Cases(), llvm::StringSwitch< T, R >::Default(), F, llvm::FixedVectorType::get(), llvm::Type::getBFloatTy(), llvm::Intrinsic::getDeclaration(), Groups, llvm::Regex::match(), Name, llvm::Intrinsic::not_intrinsic, rename(), llvm::size(), and llvm::StringSwitch< T, R >::StartsWith().
Referenced by upgradeIntrinsicFunction1().
|
static |
Definition at line 1999 of file AutoUpgrade.cpp.
References llvm::CallBase::arg_size(), llvm::CallBase::args(), llvm::IRBuilderBase::CreateCall(), emitX86Select(), llvm::CallBase::getArgOperand(), llvm::Intrinsic::getDeclaration(), llvm::Instruction::getModule(), llvm::Type::getPrimitiveSizeInBits(), llvm::Type::getScalarSizeInBits(), llvm::Value::getType(), llvm::Type::isFPOrFPVectorTy(), llvm_unreachable, and Name.
Referenced by upgradeX86IntrinsicCall().
Convert debug intrinsic calls to non-instruction debug records.
Name
- Final part of the intrinsic name, e.g. 'value' in llvm.dbg.value. CI
- The debug intrinsic call.
Definition at line 4121 of file AutoUpgrade.cpp.
References llvm::DIExpression::append(), llvm::CallBase::arg_size(), assert(), llvm::CallBase::getArgOperand(), llvm::Instruction::getDebugLoc(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), Name, and llvm::Offset.
Referenced by llvm::UpgradeIntrinsicCall().
|
static |
Definition at line 998 of file AutoUpgrade.cpp.
References assert(), llvm::StringSwitch< T, R >::Case(), llvm::StringSwitch< T, R >::Cases(), llvm::StringSwitch< T, R >::Default(), Default, F, llvm::Intrinsic::getDeclaration(), llvm::Intrinsic::getName(), Groups, Name, llvm::Intrinsic::not_intrinsic, llvm::SmallVectorTemplateBase< T, bool >::push_back(), R2, rename(), shouldUpgradeNVPTXBF16Intrinsic(), llvm::StringSwitch< T, R >::StartsWith(), upgradeArmOrAarch64IntrinsicFunction(), and upgradeX86IntrinsicFunction().
Referenced by llvm::UpgradeIntrinsicCall(), and llvm::UpgradeIntrinsicFunction().
Definition at line 5357 of file AutoUpgrade.cpp.
References llvm::MDTuple::get(), I, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorImpl< T >::reserve(), and upgradeLoopTag().
Referenced by llvm::upgradeInstructionLoopAttachment().
|
static |
Definition at line 5345 of file AutoUpgrade.cpp.
References assert(), llvm::CallingConv::C, llvm::StringRef::drop_front(), llvm::MDString::get(), llvm::StringRef::size(), and llvm::StringRef::starts_with().
Referenced by upgradeLoopArgument().
|
static |
Definition at line 1936 of file AutoUpgrade.cpp.
References applyX86MaskOn1BitsVec(), llvm::CallBase::arg_size(), CC, llvm::IRBuilderBase::CreateICmp(), llvm::FixedVectorType::get(), llvm::Constant::getAllOnesValue(), llvm::CallBase::getArgOperand(), llvm::IRBuilderBase::getInt1Ty(), llvm::Constant::getNullValue(), llvm::Value::getType(), llvm_unreachable, and Signed.
Referenced by upgradeX86IntrinsicCall().
|
static |
Definition at line 1851 of file AutoUpgrade.cpp.
References llvm::Aligned, llvm::CallingConv::C, llvm::IRBuilderBase::CreateAlignedLoad(), llvm::IRBuilderBase::CreateBitCast(), llvm::IRBuilderBase::CreateMaskedLoad(), llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::getFixedValue(), llvm::Type::getPrimitiveSizeInBits(), llvm::Value::getType(), llvm::PointerType::getUnqual(), getX86MaskVec(), and Ptr.
Referenced by upgradeX86IntrinsicCall().
Definition at line 1976 of file AutoUpgrade.cpp.
References A, B, llvm::IRBuilderBase::CreateAnd(), llvm::IRBuilderBase::CreateExtractElement(), llvm::IRBuilderBase::CreateInsertElement(), llvm::IRBuilderBase::CreateIsNotNull(), llvm::IRBuilderBase::CreateSelect(), llvm::CallBase::getArgOperand(), and Select.
Referenced by upgradeX86IntrinsicCall().
|
static |
Definition at line 1830 of file AutoUpgrade.cpp.
References llvm::Aligned, llvm::CallingConv::C, llvm::IRBuilderBase::CreateAlignedStore(), llvm::IRBuilderBase::CreateBitCast(), llvm::IRBuilderBase::CreateMaskedStore(), llvm::PointerType::getUnqual(), getX86MaskVec(), and Ptr.
Referenced by upgradeX86IntrinsicCall().
Definition at line 1990 of file AutoUpgrade.cpp.
References llvm::IRBuilderBase::CreateSExt(), llvm::CallBase::getArgOperand(), llvm::Value::getType(), and getX86MaskVec().
Referenced by upgradeX86IntrinsicCall().
Definition at line 1884 of file AutoUpgrade.cpp.
References llvm::CallBase::arg_size(), llvm::IRBuilderBase::CreateAnd(), llvm::IRBuilderBase::CreateAShr(), llvm::IRBuilderBase::CreateBitCast(), llvm::IRBuilderBase::CreateMul(), llvm::IRBuilderBase::CreateShl(), emitX86Select(), llvm::CallBase::getArgOperand(), llvm::Value::getType(), LHS, and RHS.
Referenced by upgradeX86IntrinsicCall().
|
static |
Definition at line 56 of file AutoUpgrade.cpp.
References F, llvm::FixedVectorType::get(), llvm::Intrinsic::getDeclaration(), llvm::Type::getFloatTy(), and rename().
Referenced by upgradeX86IntrinsicFunction().
This checks for objc retain release marker which should be upgraded.
It returns true if module is modified.
Definition at line 4932 of file AutoUpgrade.cpp.
References llvm::Module::Error, llvm::MDString::get(), llvm::NamedMDNode::getOperand(), and llvm::SmallVectorBase< Size_T >::size().
Referenced by llvm::UpgradeARCRuntime().
|
static |
Definition at line 1608 of file AutoUpgrade.cpp.
References assert(), llvm::IRBuilderBase::CreateShuffleVector(), emitX86Select(), llvm::Constant::getNullValue(), llvm::Value::getType(), Idx, and llvm::isPowerOf2_32().
Referenced by upgradeX86IntrinsicCall().
|
static |
Definition at line 109 of file AutoUpgrade.cpp.
References F, llvm::Intrinsic::getDeclaration(), and rename().
Referenced by upgradeX86IntrinsicFunction().
|
static |
Definition at line 99 of file AutoUpgrade.cpp.
References F, llvm::Intrinsic::getDeclaration(), and rename().
Referenced by upgradeX86IntrinsicFunction().
|
static |
Definition at line 1714 of file AutoUpgrade.cpp.
References llvm::CallBase::arg_size(), llvm::IRBuilderBase::CreateCall(), emitX86Select(), llvm::Intrinsic::getDeclaration(), llvm::Instruction::getModule(), llvm::User::getOperand(), and llvm::Value::getType().
Referenced by upgradeX86IntrinsicCall().
|
static |
Definition at line 1796 of file AutoUpgrade.cpp.
References llvm::CallBase::arg_size(), llvm::IRBuilderBase::CreateCall(), llvm::IRBuilderBase::CreateIntCast(), llvm::IRBuilderBase::CreateVectorSplat(), emitX86Select(), llvm::ConstantAggregateZero::get(), llvm::CallBase::getArgOperand(), llvm::Intrinsic::getDeclaration(), llvm::Instruction::getModule(), llvm::User::getOperand(), llvm::Type::getScalarType(), llvm::Value::getType(), and std::swap().
Referenced by upgradeX86IntrinsicCall().
|
static |
Definition at line 2248 of file AutoUpgrade.cpp.
References A, Addr, llvm::Aligned, applyX86MaskOn1BitsVec(), llvm::CallBase::arg_size(), llvm::CallBase::args(), assert(), B, llvm::CallingConv::C, llvm::IRBuilderBase::CreateAdd(), llvm::IRBuilderBase::CreateAlignedLoad(), llvm::IRBuilderBase::CreateAlignedStore(), llvm::IRBuilderBase::CreateAnd(), llvm::IRBuilderBase::CreateBitCast(), llvm::IRBuilderBase::CreateCall(), llvm::IRBuilderBase::CreateExtractElement(), llvm::IRBuilderBase::CreateExtractValue(), llvm::IRBuilderBase::CreateFAdd(), llvm::IRBuilderBase::CreateFDiv(), llvm::IRBuilderBase::CreateFMul(), llvm::IRBuilderBase::CreateFNeg(), llvm::IRBuilderBase::CreateFPExt(), llvm::IRBuilderBase::CreateFSub(), llvm::IRBuilderBase::CreateICmp(), llvm::IRBuilderBase::CreateICmpEQ(), llvm::IRBuilderBase::CreateInsertElement(), llvm::IRBuilderBase::CreateLoad(), llvm::IRBuilderBase::CreateMul(), llvm::IRBuilderBase::CreateNot(), llvm::IRBuilderBase::CreateOr(), llvm::IRBuilderBase::CreatePointerCast(), llvm::IRBuilderBase::CreateSExt(), llvm::IRBuilderBase::CreateShuffleVector(), llvm::IRBuilderBase::CreateSIToFP(), llvm::IRBuilderBase::CreateSub(), llvm::IRBuilderBase::CreateTrunc(), llvm::IRBuilderBase::CreateUIToFP(), llvm::IRBuilderBase::CreateVectorSplat(), llvm::IRBuilderBase::CreateXor(), llvm::IRBuilderBase::CreateZExt(), emitX86ScalarSelect(), emitX86Select(), F, llvm::ConstantAsMetadata::get(), llvm::MDNode::get(), llvm::FixedVectorType::get(), llvm::PoisonValue::get(), llvm::ConstantAggregateZero::get(), llvm::Constant::getAllOnesValue(), llvm::CallBase::getArgOperand(), llvm::Intrinsic::getDeclaration(), llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::getFixedValue(), llvm::Type::getHalfTy(), llvm::IRBuilderBase::getInt16Ty(), llvm::IRBuilderBase::getInt32Ty(), llvm::Type::getInt32Ty(), llvm::Type::getInt64Ty(), llvm::IRBuilderBase::getInt8(), llvm::Instruction::getModule(), llvm::Constant::getNullValue(), getNumElements(), llvm::User::getOperand(), llvm::Type::getPrimitiveSizeInBits(), llvm::Type::getScalarSizeInBits(), llvm::ShuffleVectorInst::getShuffleMask(), llvm::Value::getType(), llvm::PointerType::getUnqual(), getX86MaskVec(), High, I, Intr, llvm::Type::isIntegerTy(), LHS, llvm_unreachable, Name, llvm::Offset, Ptr, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::Value::replaceAllUsesWith(), RHS, llvm::Instruction::setMetadata(), Size, std::swap(), upgradeAbs(), upgradeAVX512MaskToSelect(), upgradeMaskedCompare(), upgradeMaskedLoad(), upgradeMaskedMove(), upgradeMaskedStore(), upgradeMaskToInt(), upgradePMULDQ(), upgradeX86ALIGNIntrinsics(), upgradeX86BinaryIntrinsics(), upgradeX86ConcatShift(), upgradeX86MaskedShift(), upgradeX86PSLLDQIntrinsics(), upgradeX86PSRLDQIntrinsics(), upgradeX86Rotate(), upgradeX86vpcom(), and upgradeX86VPERMT2Intrinsics().
Referenced by llvm::UpgradeIntrinsicCall().
Definition at line 486 of file AutoUpgrade.cpp.
References llvm::StringSwitch< T, R >::Case(), llvm::StringSwitch< T, R >::Default(), F, llvm::Intrinsic::getDeclaration(), Idx, Name, llvm::Intrinsic::not_intrinsic, rename(), shouldUpgradeX86Intrinsic(), upgradePTESTIntrinsic(), upgradeX86BF16DPIntrinsic(), upgradeX86BF16Intrinsic(), upgradeX86IntrinsicsWith8BitMask(), and upgradeX86MaskedFPCompare().
Referenced by upgradeIntrinsicFunction1().
|
static |
Definition at line 72 of file AutoUpgrade.cpp.
References F, llvm::Intrinsic::getDeclaration(), llvm::Type::isIntegerTy(), and rename().
Referenced by upgradeX86IntrinsicFunction().
|
static |
Definition at line 88 of file AutoUpgrade.cpp.
References F, llvm::Intrinsic::getDeclaration(), and rename().
Referenced by upgradeX86IntrinsicFunction().
|
static |
Definition at line 1968 of file AutoUpgrade.cpp.
References llvm::IRBuilderBase::CreateCall(), emitX86Select(), llvm::CallBase::getArgOperand(), llvm::Intrinsic::getDeclaration(), and llvm::Instruction::getModule().
Referenced by upgradeX86IntrinsicCall().
|
static |
Definition at line 1493 of file AutoUpgrade.cpp.
References llvm::IRBuilderBase::CreateBitCast(), llvm::IRBuilderBase::CreateShuffleVector(), llvm::FixedVectorType::get(), llvm::IRBuilderBase::getInt8Ty(), llvm::Constant::getNullValue(), and Idx.
Referenced by upgradeX86IntrinsicCall().
|
static |
Definition at line 1527 of file AutoUpgrade.cpp.
References llvm::IRBuilderBase::CreateBitCast(), llvm::IRBuilderBase::CreateShuffleVector(), llvm::FixedVectorType::get(), llvm::IRBuilderBase::getInt8Ty(), llvm::Constant::getNullValue(), and Idx.
Referenced by upgradeX86IntrinsicCall().
Definition at line 1730 of file AutoUpgrade.cpp.
References llvm::CallBase::arg_size(), llvm::IRBuilderBase::CreateCall(), llvm::IRBuilderBase::CreateIntCast(), llvm::IRBuilderBase::CreateVectorSplat(), emitX86Select(), llvm::CallBase::getArgOperand(), llvm::Intrinsic::getDeclaration(), llvm::Instruction::getModule(), llvm::User::getOperand(), llvm::Type::getScalarType(), and llvm::Value::getType().
Referenced by upgradeX86IntrinsicCall().
|
static |
Definition at line 1757 of file AutoUpgrade.cpp.
References llvm::IRBuilderBase::CreateICmp(), llvm::IRBuilderBase::CreateSExt(), llvm::Constant::getAllOnesValue(), llvm::CallBase::getArgOperand(), llvm::Constant::getNullValue(), llvm::Value::getType(), LHS, llvm_unreachable, and RHS.
Referenced by upgradeX86IntrinsicCall().
|
static |
Definition at line 1653 of file AutoUpgrade.cpp.
References llvm::IRBuilderBase::CreateBitCast(), llvm::IRBuilderBase::CreateCall(), emitX86Select(), llvm::ConstantAggregateZero::get(), llvm::CallBase::getArgOperand(), llvm::Intrinsic::getDeclaration(), llvm::Instruction::getModule(), llvm::Type::getPrimitiveSizeInBits(), llvm::Type::getScalarSizeInBits(), llvm::Value::getType(), llvm::Type::isFPOrFPVectorTy(), llvm_unreachable, and std::swap().
Referenced by upgradeX86IntrinsicCall().