27#define DEBUG_TYPE "codegen-common"
33 const MDNode *MD =
I.getMetadata(LLVMContext::MD_mem_cache_hint);
40 if (OpNoCI->getZExtValue() == OperandNo)
50StackProtectorDescriptor::addSuccessorMBB(
58 MF->
insert(++BBI, SuccMBB);
77 if (!
MI.isCopy() && !
MI.isImplicitDef()) {
82 if (
MI.isDebugInstr())
87 switch (
MI.getOpcode()) {
88 case TargetOpcode::G_TRUNC:
89 case TargetOpcode::G_ZEXT:
90 case TargetOpcode::G_ANYEXT:
91 case TargetOpcode::G_SEXT:
92 case TargetOpcode::G_MERGE_VALUES:
93 case TargetOpcode::G_UNMERGE_VALUES:
94 case TargetOpcode::G_CONCAT_VECTORS:
95 case TargetOpcode::G_BUILD_VECTOR:
96 case TargetOpcode::G_EXTRACT:
116 if (
MI.isImplicitDef())
123 &&
"Should have a copy implying we should have 2 arguments.");
127 if (!OPI2->
isReg() ||
151 if (SplitPoint == BB->
begin())
158 }
while (Previous != Start && Previous->isDebugInstr());
160 if (
TII.isTailCall(*SplitPoint) &&
161 Previous->getOpcode() ==
TII.getCallFrameDestroyOpcode()) {
180 if (Previous->isCall())
182 }
while(Previous->getOpcode() !=
TII.getCallFrameSetupOpcode());
188 SplitPoint = Previous;
189 if (Previous == Start)
202 switch (
static_cast<unsigned>(InvertedTest)) {
231 return UseFCmp ? InvertedTest :
fcNone;
241 assert(Copy.getOpcode() == TargetOpcode::COPY &&
"Must be a COPY");
243 return &Copy.getOperand(1);
249 assert(Trunc.
getOpcode() == TargetOpcode::G_TRUNC &&
"Must be a G_TRUNC");
255 if (!FromLLT.isScalar()) {
260 ToLLT.getSizeInBits(),
false);
261 Ops.append(ExtOps.begin(), ExtOps.end());
268 switch (
MI.getOpcode()) {
269 case TargetOpcode::G_TRUNC:
271 case TargetOpcode::COPY:
284 const unsigned MaxExpressionSize = 128;
286 for (
auto *DefMO : DbgUsers) {
295 "Must use salvaged instruction as its location");
298 if (DbgMI->
getOpcode() != TargetOpcode::DBG_VALUE) {
300 "Must be either DBG_VALUE or DBG_VALUE_LIST");
312 bool IsValidSalvageExpr =
314 if (IsValidSalvageExpr) {
316 UseMO.
setReg(Op0->getReg());
317 UseMO.setSubReg(Op0->getSubReg());
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static MachineOperand * getSalvageOpsForTrunc(const MachineRegisterInfo &MRI, MachineInstr &Trunc, SmallVectorImpl< uint64_t > &Ops)
static MachineOperand * getSalvageOpsForCopy(const MachineRegisterInfo &MRI, MachineInstr &Copy)
static bool MIIsInTerminatorSequence(const MachineInstr &MI)
Given that the input MI is before a partial terminator sequence TSeq, return true if M + TSeq also a ...
This file contains the declarations for the subclasses of Constant, which represent the different fla...
const HexagonInstrInfo * TII
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
Represent a constant reference to an array (0 or more elements consecutively in memory),...
LLVM Basic Block Representation.
static BranchProbability getBranchProbStackProtector(bool IsLikely)
unsigned getNumElements() const
static LLVM_ABI ExtOps getExtOps(unsigned FromSize, unsigned ToSize, bool Signed)
Returns the ops for a zero- or sign-extension in a DIExpression.
static LLVM_ABI DIExpression * appendOpsToArg(const DIExpression *Expr, ArrayRef< uint64_t > Ops, unsigned ArgNo, bool StackValue=false)
Create a copy of Expr by appending the given list of Ops to each instance of the operand DW_OP_LLVM_a...
const MDOperand & getOperand(unsigned I) const
unsigned getNumOperands() const
Return number of MDNode operands.
LLVM_ABI iterator getFirstTerminator()
Returns an iterator to the first terminator instruction of this basic block.
LLVM_ABI void addSuccessor(MachineBasicBlock *Succ, BranchProbability Prob=BranchProbability::getUnknown())
Add Succ as a successor of this MachineBasicBlock.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
MachineInstrBundleIterator< MachineInstr > iterator
BasicBlockListType::iterator iterator
MachineBasicBlock * CreateMachineBasicBlock(const BasicBlock *BB=nullptr, std::optional< UniqueBBID > BBID=std::nullopt)
CreateMachineInstr - Allocate a new MachineInstr.
void insert(iterator MBBI, MachineBasicBlock *MBB)
Representation of each machine instruction.
mop_range defs()
Returns all explicit operands that are register definitions.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
bool hasDebugOperandForReg(Register Reg) const
Returns whether this debug value has at least one debug operand with the register Reg.
const MachineBasicBlock * getParent() const
LLVM_ABI const MachineOperand & getDebugExpressionOp() const
Return the operand for the complex address expression referenced by this DBG_VALUE instruction.
const MachineOperand * const_mop_iterator
LLVM_ABI int findRegisterUseOperandIdx(Register Reg, const TargetRegisterInfo *TRI, bool isKill=false) const
Returns the operand index that is a use of the specific register or -1 if it is not found.
LLVM_ABI const DIExpression * getDebugExpression() const
Return the complex address expression referenced by this DBG_VALUE instruction.
const MachineOperand & getOperand(unsigned i) const
bool isIndirectDebugValue() const
A DBG_VALUE is indirect iff the location operand is a register and the offset operand is an immediate...
MachineOperand class - Representation of each machine instruction operand.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
LLVM_ABI void setReg(Register Reg)
Change the register this operand corresponds to.
void setMetadata(const MDNode *MD)
Register getReg() const
getReg - Returns the register number.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
LLT getType(Register Reg) const
Get the low-level type of Reg or LLT{} if Reg is not a generic (target independent) virtual register.
constexpr bool isPhysical() const
Return true if the specified register number is in the physical register namespace.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
TargetInstrInfo - Interface to description of machine instruction set.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
std::enable_if_t< detail::IsValidPointer< X, Y >::value, X * > extract(Y &&MD)
Extract a Value from Metadata.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI FPClassTest invertFPClassTestIfSimpler(FPClassTest Test, bool UseFCmp)
Evaluates if the specified FP class test is better performed as the inverse (i.e.
LLVM_ABI MachineBasicBlock::iterator findSplitPointForStackProtector(MachineBasicBlock *BB, const TargetInstrInfo &TII)
Find the split point at which to splice the end of BB into its success stack protector check machine ...
FPClassTest
Floating-point class tests, supported by 'is_fpclass' intrinsic.
LLVM_ABI const MDNode * getMemCacheHintMetadata(const Instruction &I, unsigned OperandNo=0)
Return the cache hint metadata node for memory operand OperandNo on I, or nullptr when the instructio...
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
LLVM_ABI Value * salvageDebugInfoImpl(Instruction &I, uint64_t CurrentLocOps, SmallVectorImpl< uint64_t > &Ops, SmallVectorImpl< Value * > &AdditionalValues)
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
LLVM_ABI void salvageDebugInfoForDbgValue(const MachineRegisterInfo &MRI, MachineInstr &MI, ArrayRef< MachineOperand * > DbgUsers)
Assuming the instruction MI is going to be deleted, attempt to salvage debug users of MI by writing t...