73 cl::desc(
"Leave out unnecessary information when printing MIR"));
76 cl::desc(
"Print MIR debug-locations"));
81struct FrameIndexOperand {
86 FrameIndexOperand(
StringRef Name,
unsigned ID,
bool IsFixed)
87 : Name(Name.str()), ID(ID), IsFixed(IsFixed) {}
90 static FrameIndexOperand create(StringRef Name,
unsigned ID) {
91 return FrameIndexOperand(Name, ID,
false);
95 static FrameIndexOperand createFixed(
unsigned ID) {
96 return FrameIndexOperand(
"", ID,
true);
101 MachineModuleSlotTracker MST;
102 DenseMap<const uint32_t *, unsigned> RegisterMaskIds;
105 DenseMap<int, FrameIndexOperand> StackObjectOperandMapping;
110 : MST(std::
move(Fn), &MF) {}
118 Mod.print(OS,
nullptr);
139 RegisterMaskIds.
insert(std::make_pair(Mask,
I++));
140 return RegisterMaskIds;
157 std::vector<yaml::SaveRestorePointEntry> &YamlSRPoints,
180 MFPrintState State(std::move(Fn), MF);
202 YamlMF.
Selected = Props.hasSelected();
206 YamlMF.
NoPHIs = Props.hasNoPHIs();
207 YamlMF.
IsSSA = Props.hasIsSSA();
208 YamlMF.
NoVRegs = Props.hasNoVRegs();
220 const auto &SubSrc =
Sub.Src;
221 const auto &SubDest =
Sub.Dest;
237 bool IsNewlineNeeded =
false;
238 for (
const auto &
MBB : MF) {
242 IsNewlineNeeded =
true;
254 Out.setWriteDefaultValues(
true);
260 assert(RegMask &&
"Can't print an empty register mask");
263 bool IsRegInRegMaskFound =
false;
264 for (
int I = 0,
E =
TRI->getNumRegs();
I <
E;
I++) {
266 if (RegMask[
I / 32] & (1u << (
I % 32))) {
267 if (IsRegInRegMaskFound)
270 IsRegInRegMaskFound =
true;
288 std::array<std::string *, 3> Outputs{{&Object.DebugVar.Value,
289 &Object.DebugExpr.Value,
290 &Object.DebugLoc.Value}};
291 std::array<const Metadata *, 3> Metas{{DebugVar.
Var,
294 for (
unsigned i = 0; i < 3; ++i) {
296 Metas[i]->printAsOperand(StrOS, MST);
301 std::vector<yaml::FlowStringValue> &RegisterFlags,
304 auto FlagValues =
TRI->getVRegFlagsOfReg(
Reg, MF);
305 for (
auto &Flag : FlagValues)
315 for (
unsigned I = 0,
E =
RegInfo.getNumVirtRegs();
I <
E; ++
I) {
328 const auto &AntiHints =
RegInfo.getRegAllocationAntiHints(
Reg);
329 if (!AntiHints.empty()) {
330 std::vector<yaml::FlowStringValue> AntiHintStrings;
331 for (
Register AntiHint : AntiHints) {
334 AntiHintStrings.push_back(std::move(AntiHintStr));
336 VReg.
AntiHints = std::move(AntiHintStrings);
340 if (Orig && Orig !=
Reg) {
353 for (std::pair<MCRegister, Register> LI :
RegInfo.liveins()) {
358 YamlMF.
LiveIns.push_back(std::move(LiveIn));
362 if (
RegInfo.isUpdatedCSRsInitialized()) {
364 std::vector<yaml::FlowStringValue> CalleeSavedRegisters;
368 CalleeSavedRegisters.push_back(std::move(
Reg));
411 MCRegister EntryValReg = DebugVar.getEntryValueRegister();
417 const MFPrintState &State,
419 auto ObjectInfo = State.StackObjectOperandMapping.find(FrameIndex);
420 assert(ObjectInfo != State.StackObjectOperandMapping.end() &&
421 "Invalid frame index");
422 const FrameIndexOperand &Operand = ObjectInfo->second;
438 FixedStackObjectsIdx.
reserve(-BeginIdx);
441 for (
int I = BeginIdx;
I < 0; ++
I, ++ID) {
460 State.StackObjectOperandMapping.insert(
461 std::make_pair(
I, FrameIndexOperand::createFixed(ID)));
469 StackObjectsIdx.
reserve(EndIdx);
471 for (
int I = 0;
I < EndIdx; ++
I, ++ID) {
480 Alloca->hasName() ? Alloca->getName() :
"");
494 State.StackObjectOperandMapping.insert(std::make_pair(
495 I, FrameIndexOperand::create(YamlObject.
Name.
Value, ID)));
499 const int FrameIdx = CSInfo.getFrameIdx();
505 if (!CSInfo.isSpilledToReg()) {
508 "Invalid stack object index");
513 Object.CalleeSavedRegister = std::move(
Reg);
514 Object.CalleeSavedRestored = CSInfo.isRestored();
516 auto &Object = YMF.
StackObjects[StackObjectsIdx[FrameIdx]];
517 Object.CalleeSavedRegister = std::move(
Reg);
518 Object.CalleeSavedRestored = CSInfo.isRestored();
524 assert(LocalObject.first >= 0 &&
"Expected a locally mapped stack object");
525 YMF.
StackObjects[StackObjectsIdx[LocalObject.first]].LocalOffset =
544 int Idx = DebugVar.getStackSlot();
546 "Invalid stack object index");
575 CallLocation.
Offset = std::distance(
MBB.instr_begin(), CallI);
578 auto [ArgRegPairs, CalleeTypeIds,
_] = CallSiteInfo;
580 for (
auto ArgReg : ArgRegPairs) {
582 YmlArgReg.
ArgNo = ArgReg.ArgNo;
587 for (
auto *CalleeTypeId : CalleeTypeIds) {
591 {{
MBB.getNumber(), CallLocation.
Offset}, std::move(YmlCS)});
596 for (
auto &Entry : Entries)
605 for (
auto &MD : MDList) {
627 Entries.
push_back({{
MBB.getNumber(), CallSite.Offset}, std::move(YamlCG)});
632 for (
auto &Entry : Entries)
642 StrOS <<
"bb_id " << BBID.BaseID <<
", " << BBID.CloneID <<
", "
655 if (
Constant.isMachineConstantPoolEntry())
661 YamlConstant.
ID = ID++;
662 YamlConstant.
Value = std::move(Str);
666 MF.
Constants.push_back(std::move(YamlConstant));
672 std::vector<yaml::SaveRestorePointEntry> &YamlSRPoints,
675 for (
const auto &[
MBB, CSInfos] : SRPoints) {
680 Entry.Point = StrOS.
str().
str();
685 Entry.Registers.push_back(StrOS.
str().
str());
690 std::sort(Entry.Registers.begin(), Entry.Registers.end(),
692 return Lhs.Value < Rhs.Value;
694 YamlSRPoints.push_back(std::move(Entry));
697 std::sort(YamlSRPoints.begin(), YamlSRPoints.end(),
700 return Lhs.Point.Value < Rhs.Point.Value;
712 for (
const auto *
MBB :
Table.MBBs) {
715 Entry.Blocks.push_back(Str);
718 YamlJTI.
Entries.push_back(std::move(Entry));
724 bool &IsFallthrough) {
734 auto RP = Seen.
insert(Succ);
736 Result.push_back(Succ);
740 IsFallthrough =
I ==
MBB.end() || !
I->isBarrier();
745 bool GuessedFallthrough;
747 if (GuessedFallthrough) {
750 if (NextI != MF.
end()) {
756 if (GuessedSuccs.
size() !=
MBB.succ_size())
758 return std::equal(
MBB.succ_begin(),
MBB.succ_end(), GuessedSuccs.
begin());
768 bool ShouldPrintRegisterTies,
774 assert(
MBB.getNumber() >= 0 &&
"Invalid MBB number");
781 bool HasLineAttributes =
false;
783 bool canPredictProbs =
MBB.canPredictBranchProbabilities();
792 OS.
indent(2) <<
"successors:";
793 if (!
MBB.succ_empty())
796 for (
auto I =
MBB.succ_begin(),
E =
MBB.succ_end();
I !=
E; ++
I) {
799 OS <<
format(
"(0x%08" PRIx32
")",
800 MBB.getSuccProbability(
I).getNumerator());
803 HasLineAttributes =
true;
808 if (!
MBB.livein_empty()) {
810 OS.
indent(2) <<
"liveins: ";
812 for (
const auto &LI :
MBB.liveins_dbg()) {
814 if (!LI.LaneMask.all())
818 HasLineAttributes =
true;
821 if (HasLineAttributes && !
MBB.empty())
823 bool IsInBundle =
false;
825 if (IsInBundle && !
MI.isInsideBundle()) {
829 OS.
indent(IsInBundle ? 4 : 2);
843 const auto *MF =
MI.getMF();
844 const auto &MRI = MF->getRegInfo();
845 const auto &SubTarget = MF->getSubtarget();
846 const auto *
TRI = SubTarget.getRegisterInfo();
847 assert(
TRI &&
"Expected target register info");
848 const auto *
TII = SubTarget.getInstrInfo();
849 assert(
TII &&
"Expected target instruction info");
850 if (
MI.isCFIInstruction())
851 assert(
MI.getNumOperands() == 1 &&
"Expected 1 operand in CFI instruction");
854 bool ShouldPrintRegisterTies =
MI.hasComplexRegisterTies();
856 unsigned I = 0,
E =
MI.getNumOperands();
863 PrintedTypes, MRI,
false);
869 OS <<
"frame-setup ";
871 OS <<
"frame-destroy ";
897 OS <<
"unpredictable ";
899 OS <<
"noconvergent ";
918 OS <<
TII->getName(
MI.getOpcode());
926 PrintedTypes, MRI,
true);
931 if (
MCSymbol *PreInstrSymbol =
MI.getPreInstrSymbol()) {
932 OS << LS <<
"pre-instr-symbol ";
935 if (
MCSymbol *PostInstrSymbol =
MI.getPostInstrSymbol()) {
936 OS << LS <<
"post-instr-symbol ";
939 if (
MDNode *HeapAllocMarker =
MI.getHeapAllocMarker()) {
940 OS << LS <<
"heap-alloc-marker ";
941 HeapAllocMarker->printAsOperand(OS, State.MST);
943 if (
MDNode *PCSections =
MI.getPCSections()) {
944 OS << LS <<
"pcsections ";
945 PCSections->printAsOperand(OS, State.MST);
947 if (
MDNode *MMRA =
MI.getMMRAMetadata()) {
949 MMRA->printAsOperand(OS, State.MST);
952 OS << LS <<
"cfi-type " << CFIType;
953 if (
Value *DS =
MI.getDeactivationSymbol()) {
954 OS << LS <<
"deactivation-symbol ";
958 if (
auto Num =
MI.peekDebugInstrNum())
959 OS << LS <<
"debug-instr-number " << Num;
963 OS << LS <<
"debug-location ";
964 DL->printAsOperand(OS, State.MST);
968 if (!
MI.memoperands_empty()) {
970 const LLVMContext &Context = MF->getFunction().getContext();
973 for (
const auto *
Op :
MI.memoperands()) {
975 Op->print(OS, State.MST, State.SSNs, Context, &MFI,
TII);
983 return std::string(
" /* " + Comment +
" */");
990 bool ShouldPrintRegisterTies,
993 LLT TypeToPrint =
MI.getTypeToPrint(OpIdx, PrintedTypes, MRI);
995 std::string MOComment =
TII->createMIROperandComment(
MI,
Op, OpIdx);
997 switch (
Op.getType()) {
999 if (
MI.isOperandSubregIdx(OpIdx)) {
1004 if (
MI.isInlineAsm()) {
1006 unsigned ExtraInfo =
Op.getImm();
1011 int FlagIdx =
MI.findInlineAsmFlagIdx(OpIdx);
1012 if (FlagIdx >= 0 && (
unsigned)FlagIdx == OpIdx) {
1014 OS <<
F.getKindName();
1016 bool IsReg =
F.isRegDefKind() ||
F.isRegUseKind() ||
1017 F.isRegDefEarlyClobberKind();
1019 if (IsReg &&
F.hasRegClassConstraint(RCID))
1020 OS <<
':' <<
TRI->getRegClassName(
TRI->getRegClass(RCID));
1022 if (
F.isMemKind()) {
1028 if (
F.isUseOperandTiedToDef(TiedTo))
1029 OS <<
" tiedto:$" << TiedTo;
1030 if (IsReg &&
F.getRegMayBeFolded())
1056 unsigned TiedOperandIdx = 0;
1057 if (ShouldPrintRegisterTies &&
Op.isReg() &&
Op.isTied() && !
Op.isDef())
1058 TiedOperandIdx =
Op.getParent()->findTiedOperandIdx(OpIdx);
1059 Op.print(OS, State.MST, TypeToPrint, OpIdx, PrintDef,
1060 false, ShouldPrintRegisterTies, TiedOperandIdx,
1069 const auto &RegisterMaskIds = State.RegisterMaskIds;
1070 auto RegMaskInfo = RegisterMaskIds.find(
Op.getRegMask());
1071 if (RegMaskInfo != RegisterMaskIds.end())
1083 V.printAsOperand(OS,
false, MST);
1089 V.printAsOperand(OS,
true, MST);
1104 Out << const_cast<Module &>(M);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file defines the DenseMap class.
const HexagonInstrInfo * TII
This file contains an interface for creating legacy passes to print out IR in various granularities.
Module.h This file contains the declarations for the Module class.
A common definition of LaneBitmask for use in TableGen and CodeGen.
Implement a low-level type suitable for MachineInstr level instruction selection.
static void convertCallSiteObjects(yaml::MachineFunction &YMF, const MachineFunction &MF, ModuleSlotTracker &MST)
static void convertMCP(yaml::MachineFunction &MF, const MachineConstantPool &ConstantPool)
static void printMI(raw_ostream &OS, MFPrintState &State, const MachineInstr &MI)
static void convertSRPoints(ModuleSlotTracker &MST, std::vector< yaml::SaveRestorePointEntry > &YamlSRPoints, const llvm::SaveRestorePoints &SRPoints, const TargetRegisterInfo *TRI)
static DenseMap< const uint32_t *, unsigned > initRegisterMaskIds(const MachineFunction &MF)
static void convertCalledGlobals(yaml::MachineFunction &YMF, const MachineFunction &MF, MachineModuleSlotTracker &MST)
static void printMBB(raw_ostream &OS, MFPrintState &State, const MachineBasicBlock &MBB)
static std::string formatOperandComment(std::string Comment)
static cl::opt< bool > PrintLocations("mir-debug-loc", cl::Hidden, cl::init(true), cl::desc("Print MIR debug-locations"))
static bool canPredictSuccessors(const MachineBasicBlock &MBB)
static void convertStackObjects(yaml::MachineFunction &YMF, const MachineFunction &MF, ModuleSlotTracker &MST, MFPrintState &State)
static void printStackObjectReference(raw_ostream &OS, const MFPrintState &State, int FrameIndex)
static void convertEntryValueObjects(yaml::MachineFunction &YMF, const MachineFunction &MF, ModuleSlotTracker &MST)
static void printStackObjectDbgInfo(const MachineFunction::VariableDbgInfo &DebugVar, T &Object, ModuleSlotTracker &MST)
static void printCustomRegMask(const uint32_t *RegMask, raw_ostream &OS, const TargetRegisterInfo *TRI)
static void convertMRI(yaml::MachineFunction &YamlMF, const MachineFunction &MF, const MachineRegisterInfo &RegInfo, const TargetRegisterInfo *TRI, const VirtRegMap *VRM)
static void convertMFI(ModuleSlotTracker &MST, yaml::MachineFrameInfo &YamlMFI, const MachineFrameInfo &MFI, const TargetRegisterInfo *TRI)
static void printRegMIR(Register Reg, yaml::StringValue &Dest, const TargetRegisterInfo *TRI)
static cl::opt< bool > SimplifyMIR("simplify-mir", cl::Hidden, cl::desc("Leave out unnecessary information when printing MIR"))
static void printMF(raw_ostream &OS, MFGetterFnT Fn, const MachineFunction &MF, const VirtRegMap *VRM)
static void printMIOperand(raw_ostream &OS, MFPrintState &State, const MachineInstr &MI, unsigned OpIdx, const TargetRegisterInfo *TRI, const TargetInstrInfo *TII, bool ShouldPrintRegisterTies, SmallBitVector &PrintedTypes, const MachineRegisterInfo &MRI, bool PrintDef)
static void printRegFlags(Register Reg, std::vector< yaml::FlowStringValue > &RegisterFlags, const MachineFunction &MF, const TargetRegisterInfo *TRI)
static void convertPrefetchTargets(yaml::MachineFunction &YMF, const MachineFunction &MF)
static void convertMachineMetadataNodes(yaml::MachineFunction &YMF, const MachineFunction &MF, MachineModuleSlotTracker &MST)
static void convertMJTI(ModuleSlotTracker &MST, yaml::MachineJumpTable &YamlJTI, const MachineJumpTableInfo &JTI)
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
Register const TargetRegisterInfo * TRI
FunctionAnalysisManager FAM
This file implements the SmallBitVector class.
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
This class represents a function call, abstracting a target machine's calling convention.
The CalleeSavedInfo class tracks the information need to locate where a callee saved register is in t...
This is an important base class in LLVM.
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
Module * getParent()
Get the module that this global value is contained inside of...
static std::vector< StringRef > getExtraInfoNames(unsigned ExtraInfo)
static StringRef getMemConstraintName(ConstraintCode C)
This is an important class for using LLVM in a threaded context.
A helper class to return the specified delimiter string after the first invocation of operator String...
Wrapper class representing physical registers. Should be passed by value.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
MachineInstrBundleIterator< const MachineInstr > const_iterator
@ PrintNameIr
Add IR name where available.
@ PrintNameAttributes
Print attributes.
Instructions::const_iterator const_instr_iterator
This class is a data container for one entry in a MachineConstantPool.
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
uint64_t getStackSize() const
Return the number of bytes that must be allocated to hold all of the fixed size frame objects.
const AllocaInst * getObjectAllocation(int ObjectIdx) const
Return the underlying Alloca of the specified stack object if it exists.
bool adjustsStack() const
Return true if this function adjusts the stack – e.g., when calling another function.
bool isReturnAddressTaken() const
This method may be called any time after instruction selection is complete to determine if there is a...
int64_t getLocalFrameObjectCount() const
Return the number of objects allocated into the local object block.
bool hasCalls() const
Return true if the current function has any function calls.
bool isFrameAddressTaken() const
This method may be called any time after instruction selection is complete to determine if there is a...
FramePointerKind getFramePointerPolicy() const
Align getMaxAlign() const
Return alignment of this function's frame.
std::pair< int, int64_t > getLocalFrameObjectMap(int i) const
Get the local offset mapping for a for an object.
uint64_t getMaxCallFrameSize() const
Return the maximum size of a call frame that must be allocated for an outgoing function call.
bool hasPatchPoint() const
This method may be called any time after instruction selection is complete to determine if there is a...
bool hasOpaqueSPAdjustment() const
Returns true if the function contains opaque dynamic stack adjustments.
bool isImmutableObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to an immutable object.
int getStackProtectorIndex() const
Return the index for the stack protector object.
int64_t getOffsetAdjustment() const
Return the correction for frame offsets.
bool hasTailCall() const
Returns true if the function contains a tail call.
bool hasMustTailInVarArgFunc() const
Returns true if the function is variadic and contains a musttail call.
bool isCalleeSavedInfoValid() const
Has the callee saved info been calculated yet?
Align getObjectAlign(int ObjectIdx) const
Return the alignment of the specified stack object.
bool isSpillSlotObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a spill slot.
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
bool isMaxCallFrameSizeComputed() const
int64_t getLocalFrameSize() const
Get the size of the local object blob.
bool hasStackMap() const
This method may be called any time after instruction selection is complete to determine if there is a...
const std::vector< CalleeSavedInfo > & getCalleeSavedInfo() const
Returns a reference to call saved info vector for the current function.
bool hasVAStart() const
Returns true if the function calls the llvm.va_start intrinsic.
unsigned getCVBytesOfCalleeSavedRegisters() const
Returns how many bytes of callee-saved registers the target pushed in the prologue.
bool isVariableSizedObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a variable sized object.
int getObjectIndexEnd() const
Return one past the maximum frame object index.
bool hasStackProtectorIndex() const
uint8_t getStackID(int ObjectIdx) const
const SaveRestorePoints & getRestorePoints() const
unsigned getNumFixedObjects() const
Return the number of fixed objects.
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
bool hasFunctionContextIndex() const
int getObjectIndexBegin() const
Return the minimum frame object index.
const SaveRestorePoints & getSavePoints() const
bool isDeadObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a dead object.
int getFunctionContextIndex() const
Return the index for the function context object.
bool isAliasedObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to an object that might be pointed to by an LLVM IR v...
This analysis create MachineFunction for given Function.
Properties which a MachineFunction may have at a given point in time.
Description of the location of a variable whose Address is valid and unchanging during function execu...
const DILocalVariable * Var
const DIExpression * Expr
auto getEntryValueVariableDbgInfo() const
Returns the collection of variables for which we have debug info and that have been assigned an entry...
bool useDebugInstrRef() const
Returns true if the function's variable locations are tracked with instruction referencing.
SmallVector< DebugSubstitution, 8 > DebugValueSubstitutions
Debug value substitutions: a collection of DebugSubstitution objects, recording changes in where a va...
const DenseMap< UniqueBBID, SmallVector< unsigned > > & getPrefetchTargets() const
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
bool exposesReturnsTwice() const
exposesReturnsTwice - Returns true if the function calls setjmp or any other similar functions with a...
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
bool callsUnwindInit() const
const CallSiteInfoMap & getCallSitesInfo() const
bool callsEHReturn() const
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
auto getInStackSlotVariableDbgInfo()
Returns the collection of variables for which we have debug info and that have been assigned a stack ...
Align getAlignment() const
getAlignment - Return the alignment of the function.
Function & getFunction()
Return the LLVM function that this machine code represents.
MachineConstantPool * getConstantPool()
getConstantPool - Return the constant pool object for the current function.
const MachineFunctionProperties & getProperties() const
Get the function properties.
bool hasEHFunclets() const
const MachineJumpTableInfo * getJumpTableInfo() const
getJumpTableInfo - Return the jump table info object for the current function.
auto getCalledGlobals() const
Iterates over the full set of call sites and their associated globals.
bool hasEHContTarget() const
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
BasicBlockListType::const_iterator const_iterator
Representation of each machine instruction.
JTEntryKind getEntryKind() const
const std::vector< MachineJumpTableEntry > & getJumpTables() const
This class contains meta information specific to a module.
LLVM_ABI MachineFunction * getMachineFunction(const Function &F) const
Returns the MachineFunction associated to IR function F if there is one, otherwise nullptr.
void collectMachineMDNodes(MachineMDNodeListType &L) const
MachineOperand class - Representation of each machine instruction operand.
static LLVM_ABI void printStackObjectReference(raw_ostream &OS, unsigned FrameIndex, bool IsFixed, StringRef Name)
Print a stack object reference.
static LLVM_ABI void printSubRegIdx(raw_ostream &OS, uint64_t Index, const TargetRegisterInfo *TRI)
Print a subreg index operand.
static LLVM_ABI void printTargetFlags(raw_ostream &OS, const MachineOperand &Op)
Print operand target flags.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
static LLVM_ABI void printIRSlotNumber(raw_ostream &OS, int Slot)
Print an IRSlotNumber.
static LLVM_ABI void printSymbol(raw_ostream &OS, MCSymbol &Sym)
Print a MCSymbol as an operand.
@ MO_CFIIndex
MCCFIInstruction index.
@ MO_Immediate
Immediate operand.
@ MO_ConstantPoolIndex
Address of indexed Constant in Constant Pool.
@ MO_MCSymbol
MCSymbol reference (for debug/eh info)
@ MO_Predicate
Generic predicate for ISel.
@ MO_GlobalAddress
Address of a global value.
@ MO_RegisterMask
Mask of preserved registers.
@ MO_ShuffleMask
Other IR Constant for ISel (shuffle masks)
@ MO_CImmediate
Immediate >64bit operand.
@ MO_BlockAddress
Address of a basic block.
@ MO_DbgInstrRef
Integer indices referring to an instruction+operand.
@ MO_MachineBasicBlock
MachineBasicBlock reference.
@ MO_LaneMask
Mask to represent active parts of registers.
@ MO_FrameIndex
Abstract Stack Frame Index.
@ MO_Register
Register operand.
@ MO_ExternalSymbol
Name of external global symbol.
@ MO_IntrinsicID
Intrinsic ID for ISel.
@ MO_JumpTableIndex
Address of indexed Jump Table for switch.
@ MO_TargetIndex
Target-dependent index+offset operand.
@ MO_Metadata
Metadata reference (for debug info)
@ MO_FPImmediate
Floating-point immediate operand.
@ MO_RegisterLiveOut
Mask of live-out registers.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
const TargetRegisterInfo * getTargetRegisterInfo() const
Manage lifetime of a slot tracker for printing IR.
int getLocalSlot(const Value *V)
Return the slot number of the specified local value.
const Function * getCurrentFunction() const
SmallVector< std::pair< unsigned, const MDNode * >, 0 > MachineMDNodeListType
void incorporateFunction(const Function &F)
Incorporate the given function.
A Module instance is used to store all the information related to an LLVM module.
Wrapper class representing virtual and physical registers.
static Register index2VirtReg(unsigned Index)
Convert a 0-based index to a virtual register number.
This is a 'bitvector' (really, a variable-sized bit array), optimized for the case when the array is ...
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void reserve(size_type N)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
std::string str() const
Get the contents as an std::string.
LLVM_ABI std::string lower() const
TargetInstrInfo - Interface to description of machine instruction set.
Primary interface to the complete machine description for the target machine.
virtual yaml::MachineFunctionInfo * convertFuncInfoToYAML(const MachineFunction &MF) const
Allocate and initialize an instance of the YAML representation of the MachineFunctionInfo.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
virtual const TargetRegisterInfo * getRegisterInfo() const =0
Return the target's register information.
LLVM Value Representation.
LLVM_ABI void print(raw_ostream &O, bool IsForDebug=false) const
Implement operator<< on Value.
LLVM_ABI void printAsOperand(raw_ostream &O, bool PrintType=true, const Module *M=nullptr) const
Print the name of this Value out to the specified raw_ostream.
Register getPreSplitReg(Register virtReg) const
returns the live interval virtReg is split from.
MCRegister getPhys(Register virtReg) const
returns the physical register mapped to the specified virtual register
bool hasPhys(Register virtReg) const
returns true if the specified virtual register is mapped to a physical register
const ParentTy * getParent() const
self_iterator getIterator()
This class implements an extremely fast bulk output stream that can only output to a stream.
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
A raw_ostream that writes to an std::string.
A raw_ostream that writes to an SmallVector or SmallString.
StringRef str() const
Return a StringRef for the vector contents.
The Output class is used to generate a yaml document from in-memory structs and vectors.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
void interleave(ForwardIterator begin, ForwardIterator end, UnaryFunctor each_fn, NullaryFunctor between_fn)
An STL-style algorithm similar to std::for_each that applies a second functor between every pair of e...
Printable PrintLaneMask(LaneBitmask LaneMask)
Create Printable object to print LaneBitmasks on a raw_ostream.
LLVM_ABI void printMIR(raw_ostream &OS, const Module &M)
Print LLVM IR using the MIR serialization format to the given output stream.
LLVM_ABI void guessSuccessors(const MachineBasicBlock &MBB, SmallVectorImpl< MachineBasicBlock * > &Result, bool &IsFallthrough)
Determine a possible list of successors of a basic block based on the basic block machine operand bei...
function_ref< MachineFunction *(const Function &)> MFGetterFnT
DenseMap< MachineBasicBlock *, std::vector< CalleeSavedInfo > > SaveRestorePoints
void sort(IteratorTy Start, IteratorTy End)
LLVM_ABI Printable printRegClassOrBank(Register Reg, const MachineRegisterInfo &RegInfo, const TargetRegisterInfo *TRI)
Create Printable object to print register classes or register banks on a raw_ostream.
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
@ Mod
The access may modify the value stored in memory.
@ Sub
Subtraction of integers.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
DWARFExpression::Operation Op
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Next
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
LLVM_ABI void printLLVMNameWithoutPrefix(raw_ostream &OS, StringRef Name)
Print out a name of an LLVM value without any prefixes.
LLVM_ABI Printable printReg(Register Reg, const TargetRegisterInfo *TRI=nullptr, unsigned SubIdx=0, const MachineRegisterInfo *MRI=nullptr)
Prints virtual and physical registers with or without a TRI instance.
LLVM_ABI Printable printMBBReference(const MachineBasicBlock &MBB)
Prints a machine basic block reference.
constexpr uint64_t value() const
This is a hole in the type system and should not be abused.
Function object to check whether the first component of a container supported by std::get (like std::...
This class should be specialized by type that requires custom conversion to/from a YAML literal block...
Serializable representation of CallSiteInfo.
std::vector< uint64_t > CalleeTypeIds
Numeric callee type identifiers for the callgraph section.
std::vector< ArgRegPair > ArgForwardingRegs
MachineInstrLoc CallLocation
Serializable representation of the MCRegister variant of MachineFunction::VariableDbgInfo.
Serializable representation of the fixed stack object from the MachineFrameInfo class.
TargetStackID::Value StackID
Serializable representation of MachineFrameInfo.
std::vector< SaveRestorePointEntry > RestorePoints
bool IsCalleeSavedInfoValid
unsigned MaxCallFrameSize
~0u means: not computed yet.
FramePointerKind FramePointerPolicy
StringValue StackProtector
std::vector< SaveRestorePointEntry > SavePoints
bool HasMustTailInVarArgFunc
unsigned CVBytesOfCalleeSavedRegisters
bool HasOpaqueSPAdjustment
bool IsReturnAddressTaken
StringValue FunctionContext
StringValue VirtualRegister
std::vector< MachineStackObject > StackObjects
std::vector< StringValue > MachineMetadataNodes
std::optional< std::vector< FlowStringValue > > CalleeSavedRegisters
std::vector< CalledGlobal > CalledGlobals
std::optional< bool > HasFakeUses
std::vector< EntryValueObject > EntryValueObjects
std::optional< bool > NoPHIs
std::vector< FlowStringValue > PrefetchTargets
bool TracksDebugUserValues
std::vector< MachineConstantPoolValue > Constants
std::optional< bool > NoVRegs
std::vector< CallSiteInfo > CallSitesInfo
std::vector< MachineFunctionLiveIn > LiveIns
std::vector< VirtualRegisterDefinition > VirtualRegisters
std::vector< FixedMachineStackObject > FixedStackObjects
std::optional< bool > IsSSA
std::vector< DebugValueSubstitution > DebugValueSubstitutions
std::unique_ptr< MachineFunctionInfo > MachineFuncInfo
Constant pool.
MachineJumpTable JumpTableInfo
MachineFrameInfo FrameInfo
Identifies call instruction location in machine function.
std::vector< Entry > Entries
MachineJumpTableInfo::JTEntryKind Kind
Serializable representation of stack object from the MachineFrameInfo class.
TargetStackID::Value StackID
A wrapper around std::string which contains a source range that's being set during parsing.
std::vector< FlowStringValue > AntiHints
std::vector< FlowStringValue > RegisterFlags
StringValue PreferredRegister
static void output(const Module &Mod, void *Ctxt, raw_ostream &OS)
static StringRef input(StringRef Str, void *Ctxt, Module &Mod)