LLVM 22.0.0git
MachineInstr.cpp File Reference
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/MemoryLocation.h"
#include "llvm/CodeGen/LiveRegUnits.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineInstrBundle.h"
#include "llvm/CodeGen/MachineMemOperand.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/PseudoSourceValue.h"
#include "llvm/CodeGen/Register.h"
#include "llvm/CodeGen/StackMaps.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/CodeGenTypes/LowLevelType.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/ModuleSlotTracker.h"
#include "llvm/IR/Operator.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <cstring>
#include <utility>

Go to the source code of this file.

Typedefs

using MMOList = SmallVector<const MachineMemOperand *, 2>

Functions

static const MachineFunctiongetMFIfAvailable (const MachineInstr &MI)
static void tryToGetTargetInfo (const MachineInstr &MI, const TargetRegisterInfo *&TRI, const MachineRegisterInfo *&MRI, const TargetInstrInfo *&TII)
static void moveOperands (MachineOperand *Dst, MachineOperand *Src, unsigned NumOps, MachineRegisterInfo *MRI)
 Move NumOps MachineOperands from Src to Dst, with support for overlapping ranges.
static bool hasIdenticalMMOs (ArrayRef< MachineMemOperand * > LHS, ArrayRef< MachineMemOperand * > RHS)
 Check to see if the MMOs pointed to by the two MemRefs arrays are identical.
template<typename Operand, typename Instruction>
static iterator_range< filter_iterator< Operand *, std::function< bool(Operand &Op)> > > getDebugOperandsForRegHelper (Instruction *MI, Register Reg)
static bool MemOperandsHaveAlias (const MachineFrameInfo &MFI, BatchAAResults *AA, bool UseTBAA, const MachineMemOperand *MMOa, const MachineMemOperand *MMOb)
static const DIExpressioncomputeExprForSpill (const MachineInstr &MI, const SmallVectorImpl< const MachineOperand * > &SpilledOperands)
 Compute the new DIExpression to use with a DBG_VALUE for a spill slot.
static const DIExpressioncomputeExprForSpill (const MachineInstr &MI, Register SpillReg)
static LocationSize getSpillSlotSize (const MMOList &Accesses, const MachineFrameInfo &MFI)

Variables

static cl::opt< boolPrintMIAddrs ("print-mi-addrs", cl::Hidden, cl::desc("Print addresses of MachineInstrs when dumping"))
const unsigned TiedMax = 15

Typedef Documentation

◆ MMOList

Definition at line 2547 of file MachineInstr.cpp.

Function Documentation

◆ computeExprForSpill() [1/2]

const DIExpression * computeExprForSpill ( const MachineInstr & MI,
const SmallVectorImpl< const MachineOperand * > & SpilledOperands )
static

Compute the new DIExpression to use with a DBG_VALUE for a spill slot.

This prepends DW_OP_deref when spilling an indirect DBG_VALUE.

Definition at line 2422 of file MachineInstr.cpp.

References AbstractManglingParser< Derived, Alloc >::Ops, llvm::DIExpression::appendOpsToArg(), assert(), llvm::DIExpression::DerefBefore, MI, OpIdx, and llvm::DIExpression::prepend().

Referenced by llvm::buildDbgValueForSpill(), llvm::buildDbgValueForSpill(), computeExprForSpill(), and llvm::updateDbgValueForSpill().

◆ computeExprForSpill() [2/2]

const DIExpression * computeExprForSpill ( const MachineInstr & MI,
Register SpillReg )
static

Definition at line 2444 of file MachineInstr.cpp.

References assert(), computeExprForSpill(), llvm::make_pointer_range(), and MI.

◆ getDebugOperandsForRegHelper()

template<typename Operand, typename Instruction>
iterator_range< filter_iterator< Operand *, std::function< bool(Operand &Op)> > > getDebugOperandsForRegHelper ( Instruction * MI,
Register Reg )
static

◆ getMFIfAvailable()

◆ getSpillSlotSize()

◆ hasIdenticalMMOs()

bool hasIdenticalMMOs ( ArrayRef< MachineMemOperand * > LHS,
ArrayRef< MachineMemOperand * > RHS )
static

Check to see if the MMOs pointed to by the two MemRefs arrays are identical.

Definition at line 416 of file MachineInstr.cpp.

References LHS, llvm::make_pointee_range(), and RHS.

Referenced by llvm::MachineInstr::cloneMergedMemRefs().

◆ MemOperandsHaveAlias()

◆ moveOperands()

void moveOperands ( MachineOperand * Dst,
MachineOperand * Src,
unsigned NumOps,
MachineRegisterInfo * MRI )
static

Move NumOps MachineOperands from Src to Dst, with support for overlapping ranges.

If MRI is non-null also update use-def chains.

Definition at line 193 of file MachineInstr.cpp.

References AbstractManglingParser< Derived, Alloc >::NumOps, assert(), and MRI.

Referenced by llvm::MachineInstr::addOperand(), and llvm::MachineInstr::removeOperand().

◆ tryToGetTargetInfo()

void tryToGetTargetInfo ( const MachineInstr & MI,
const TargetRegisterInfo *& TRI,
const MachineRegisterInfo *& MRI,
const TargetInstrInfo *& TII )
static

Definition at line 78 of file MachineInstr.cpp.

References getMFIfAvailable(), MI, MRI, TII, and TRI.

Referenced by llvm::MachineInstr::print(), and llvm::MachineOperand::print().

Variable Documentation

◆ PrintMIAddrs

cl::opt< bool > PrintMIAddrs("print-mi-addrs", cl::Hidden, cl::desc("Print addresses of MachineInstrs when dumping")) ( "print-mi-addrs" ,
cl::Hidden ,
cl::desc("Print addresses of MachineInstrs when dumping")  )
static

◆ TiedMax