Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.0.0git
MIRPrinter.cpp File Reference
#include "llvm/CodeGen/MIRPrinter.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/CodeGen/MIRYamlMapping.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/CodeGen/MachineMemOperand.h"
#include "llvm/CodeGen/MachineModuleSlotTracker.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/TargetFrameLowering.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/CodeGenTypes/LowLevelType.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRPrintingPasses.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/ModuleSlotTracker.h"
#include "llvm/IR/Value.h"
#include "llvm/MC/LaneBitmask.h"
#include "llvm/Support/BranchProbability.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/YAMLTraits.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
#include <algorithm>
#include <cassert>
#include <cinttypes>
#include <cstdint>
#include <iterator>
#include <string>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

struct  llvm::yaml::BlockScalarTraits< Module >
 This struct serializes the LLVM IR module. More...

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
namespace  llvm::yaml

Functions

static void printRegMIR (Register Reg, yaml::StringValue &Dest, const TargetRegisterInfo *TRI)
static DenseMap< const uint32_t *, unsignedinitRegisterMaskIds (const MachineFunction &MF)
static void printMBB (raw_ostream &OS, MFPrintState &State, const MachineBasicBlock &MBB)
static void convertMRI (yaml::MachineFunction &YamlMF, const MachineFunction &MF, const MachineRegisterInfo &RegInfo, const TargetRegisterInfo *TRI)
static void convertMCP (yaml::MachineFunction &MF, const MachineConstantPool &ConstantPool)
static void convertMJTI (ModuleSlotTracker &MST, yaml::MachineJumpTable &YamlJTI, const MachineJumpTableInfo &JTI)
static void convertMFI (ModuleSlotTracker &MST, yaml::MachineFrameInfo &YamlMFI, const MachineFrameInfo &MFI)
static void convertSRPoints (ModuleSlotTracker &MST, std::vector< yaml::SaveRestorePointEntry > &YamlSRPoints, ArrayRef< MachineBasicBlock * > SaveRestorePoints)
static void convertStackObjects (yaml::MachineFunction &YMF, const MachineFunction &MF, ModuleSlotTracker &MST, MFPrintState &State)
static void convertEntryValueObjects (yaml::MachineFunction &YMF, const MachineFunction &MF, ModuleSlotTracker &MST)
static void convertCallSiteObjects (yaml::MachineFunction &YMF, const MachineFunction &MF, ModuleSlotTracker &MST)
static void convertMachineMetadataNodes (yaml::MachineFunction &YMF, const MachineFunction &MF, MachineModuleSlotTracker &MST)
static void convertCalledGlobals (yaml::MachineFunction &YMF, const MachineFunction &MF, MachineModuleSlotTracker &MST)
static void printMF (raw_ostream &OS, const MachineModuleInfo &MMI, const MachineFunction &MF)
static void printCustomRegMask (const uint32_t *RegMask, raw_ostream &OS, const TargetRegisterInfo *TRI)
static void printRegClassOrBank (Register Reg, yaml::StringValue &Dest, const MachineRegisterInfo &RegInfo, const TargetRegisterInfo *TRI)
template<typename T>
static void printStackObjectDbgInfo (const MachineFunction::VariableDbgInfo &DebugVar, T &Object, ModuleSlotTracker &MST)
static void printRegFlags (Register Reg, std::vector< yaml::FlowStringValue > &RegisterFlags, const MachineFunction &MF, const TargetRegisterInfo *TRI)
static void printStackObjectReference (raw_ostream &OS, const MFPrintState &State, int FrameIndex)
static bool canPredictSuccessors (const MachineBasicBlock &MBB)
static void printMI (raw_ostream &OS, MFPrintState &State, const MachineInstr &MI)
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 std::string formatOperandComment (std::string Comment)

Variables

static cl::opt< boolSimplifyMIR ("simplify-mir", cl::Hidden, cl::desc("Leave out unnecessary information when printing MIR"))
static cl::opt< boolPrintLocations ("mir-debug-loc", cl::Hidden, cl::init(true), cl::desc("Print MIR debug-locations"))

Function Documentation

◆ canPredictSuccessors()

◆ convertCalledGlobals()

◆ convertCallSiteObjects()

◆ convertEntryValueObjects()

◆ convertMachineMetadataNodes()

◆ convertMCP()

◆ convertMFI()

void convertMFI ( ModuleSlotTracker & MST,
yaml::MachineFrameInfo & YamlMFI,
const MachineFrameInfo & MFI )
static

Definition at line 341 of file MIRPrinter.cpp.

References llvm::yaml::MachineFrameInfo::AdjustsStack, llvm::MachineFrameInfo::adjustsStack(), convertSRPoints(), llvm::yaml::MachineFrameInfo::CVBytesOfCalleeSavedRegisters, llvm::MachineFrameInfo::getCVBytesOfCalleeSavedRegisters(), llvm::MachineFrameInfo::getLocalFrameSize(), llvm::MachineFrameInfo::getMaxAlign(), llvm::MachineFrameInfo::getMaxCallFrameSize(), llvm::MachineFrameInfo::getOffsetAdjustment(), llvm::MachineFrameInfo::getRestorePoints(), llvm::MachineFrameInfo::getSavePoints(), llvm::MachineFrameInfo::getStackSize(), llvm::yaml::MachineFrameInfo::HasCalls, llvm::MachineFrameInfo::hasCalls(), llvm::yaml::MachineFrameInfo::HasMustTailInVarArgFunc, llvm::MachineFrameInfo::hasMustTailInVarArgFunc(), llvm::yaml::MachineFrameInfo::HasOpaqueSPAdjustment, llvm::MachineFrameInfo::hasOpaqueSPAdjustment(), llvm::yaml::MachineFrameInfo::HasPatchPoint, llvm::MachineFrameInfo::hasPatchPoint(), llvm::yaml::MachineFrameInfo::HasStackMap, llvm::MachineFrameInfo::hasStackMap(), llvm::yaml::MachineFrameInfo::HasTailCall, llvm::MachineFrameInfo::hasTailCall(), llvm::yaml::MachineFrameInfo::HasVAStart, llvm::MachineFrameInfo::hasVAStart(), llvm::yaml::MachineFrameInfo::IsCalleeSavedInfoValid, llvm::MachineFrameInfo::isCalleeSavedInfoValid(), llvm::yaml::MachineFrameInfo::IsFrameAddressTaken, llvm::MachineFrameInfo::isFrameAddressTaken(), llvm::MachineFrameInfo::isMaxCallFrameSizeComputed(), llvm::yaml::MachineFrameInfo::IsReturnAddressTaken, llvm::MachineFrameInfo::isReturnAddressTaken(), llvm::yaml::MachineFrameInfo::LocalFrameSize, llvm::yaml::MachineFrameInfo::MaxAlignment, llvm::yaml::MachineFrameInfo::MaxCallFrameSize, llvm::yaml::MachineFrameInfo::OffsetAdjustment, llvm::yaml::MachineFrameInfo::RestorePoints, llvm::yaml::MachineFrameInfo::SavePoints, llvm::yaml::MachineFrameInfo::StackSize, and llvm::Align::value().

Referenced by printMF().

◆ convertMJTI()

◆ convertMRI()

◆ convertSRPoints()

void convertSRPoints ( ModuleSlotTracker & MST,
std::vector< yaml::SaveRestorePointEntry > & YamlSRPoints,
ArrayRef< MachineBasicBlock * > SaveRestorePoints )
static

◆ convertStackObjects()

void convertStackObjects ( yaml::MachineFunction & YMF,
const MachineFunction & MF,
ModuleSlotTracker & MST,
MFPrintState & State )
static

Definition at line 392 of file MIRPrinter.cpp.

References llvm::yaml::FixedMachineStackObject::Alignment, llvm::yaml::MachineStackObject::Alignment, assert(), llvm::yaml::FixedMachineStackObject::DefaultType, llvm::yaml::MachineStackObject::DefaultType, E(), llvm::yaml::MachineFunction::FixedStackObjects, llvm::yaml::MachineFunction::FrameInfo, llvm::yaml::MachineFrameInfo::FunctionContext, llvm::MachineFrameInfo::getCalleeSavedInfo(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFrameInfo::getFunctionContextIndex(), llvm::MachineFunction::getInStackSlotVariableDbgInfo(), llvm::MachineFrameInfo::getLocalFrameObjectCount(), llvm::MachineFrameInfo::getLocalFrameObjectMap(), llvm::MachineFrameInfo::getNumFixedObjects(), llvm::MachineFrameInfo::getObjectAlign(), llvm::MachineFrameInfo::getObjectAllocation(), llvm::MachineFrameInfo::getObjectIndexBegin(), llvm::MachineFrameInfo::getObjectIndexEnd(), llvm::MachineFrameInfo::getObjectOffset(), llvm::MachineFrameInfo::getObjectSize(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFrameInfo::getStackID(), llvm::MachineFrameInfo::getStackProtectorIndex(), llvm::MachineFunction::getSubtarget(), llvm::MachineFrameInfo::hasFunctionContextIndex(), llvm::MachineFrameInfo::hasStackProtectorIndex(), I, llvm::yaml::FixedMachineStackObject::ID, llvm::yaml::MachineStackObject::ID, llvm::yaml::FixedMachineStackObject::IsAliased, llvm::MachineFrameInfo::isAliasedObjectIndex(), llvm::MachineFrameInfo::isDeadObjectIndex(), llvm::yaml::FixedMachineStackObject::IsImmutable, llvm::MachineFrameInfo::isImmutableObjectIndex(), llvm::MachineFrameInfo::isSpillSlotObjectIndex(), llvm::MachineFrameInfo::isVariableSizedObjectIndex(), llvm::yaml::MachineStackObject::Name, llvm::yaml::FixedMachineStackObject::Offset, llvm::yaml::MachineStackObject::Offset, printRegMIR(), printStackObjectDbgInfo(), printStackObjectReference(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), Reg, llvm::SmallVectorImpl< T >::reserve(), llvm::yaml::FixedMachineStackObject::Size, llvm::yaml::MachineStackObject::Size, llvm::yaml::FixedMachineStackObject::SpillSlot, llvm::yaml::MachineStackObject::SpillSlot, llvm::yaml::FixedMachineStackObject::StackID, llvm::yaml::MachineStackObject::StackID, llvm::yaml::MachineFunction::StackObjects, llvm::yaml::MachineFrameInfo::StackProtector, TRI, llvm::yaml::FixedMachineStackObject::Type, llvm::yaml::MachineStackObject::Type, llvm::yaml::StringValue::Value, and llvm::yaml::MachineStackObject::VariableSized.

Referenced by printMF().

◆ formatOperandComment()

std::string formatOperandComment ( std::string Comment)
static

Definition at line 904 of file MIRPrinter.cpp.

Referenced by printMIOperand().

◆ initRegisterMaskIds()

◆ printCustomRegMask()

void printCustomRegMask ( const uint32_t * RegMask,
raw_ostream & OS,
const TargetRegisterInfo * TRI )
static

Definition at line 248 of file MIRPrinter.cpp.

References assert(), E(), I, llvm::printReg(), and TRI.

Referenced by printMIOperand().

◆ printMBB()

◆ printMF()

void printMF ( raw_ostream & OS,
const MachineModuleInfo & MMI,
const MachineFunction & MF )
static

Definition at line 173 of file MIRPrinter.cpp.

References llvm::yaml::MachineFunction::Alignment, llvm::yaml::MachineFunction::Body, llvm::yaml::MachineFunction::CallsEHReturn, llvm::MachineFunction::callsEHReturn(), llvm::yaml::MachineFunction::CallsUnwindInit, llvm::MachineFunction::callsUnwindInit(), convertCalledGlobals(), convertCallSiteObjects(), convertEntryValueObjects(), convertMachineMetadataNodes(), convertMCP(), convertMFI(), convertMJTI(), convertMRI(), convertStackObjects(), llvm::MachineFunction::DebugValueSubstitutions, llvm::yaml::MachineFunction::DebugValueSubstitutions, llvm::yaml::MachineFunction::ExposesReturnsTwice, llvm::MachineFunction::exposesReturnsTwice(), llvm::yaml::MachineFunction::FailedISel, llvm::yaml::MachineFunction::FailsVerification, llvm::yaml::MachineFunction::FrameInfo, llvm::MachineFunction::getAlignment(), llvm::MachineFunction::getConstantPool(), llvm::MachineFunction::getFrameInfo(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getJumpTableInfo(), llvm::MachineFunction::getName(), llvm::MachineFunction::getProperties(), llvm::MachineFunction::getRegInfo(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), llvm::MachineFunction::getTarget(), llvm::yaml::MachineFunction::HasEHContTarget, llvm::MachineFunction::hasEHContTarget(), llvm::yaml::MachineFunction::HasEHFunclets, llvm::MachineFunction::hasEHFunclets(), llvm::yaml::MachineFunction::HasEHScopes, llvm::MachineFunction::hasEHScopes(), llvm::yaml::MachineFunction::HasFakeUses, llvm::MachineFunction::hasFakeUses(), llvm::yaml::MachineFunction::HasWinCFI, llvm::MachineFunction::hasWinCFI(), llvm::ModuleSlotTracker::incorporateFunction(), initRegisterMaskIds(), llvm::yaml::MachineFunction::IsOutlined, llvm::MachineFunction::isOutlined(), llvm::yaml::MachineFunction::IsSSA, llvm::yaml::MachineFunction::JumpTableInfo, llvm::yaml::MachineFunction::Legalized, llvm::yaml::MachineFunction::MachineFuncInfo, MBB, llvm::yaml::MachineFunction::Name, llvm::yaml::MachineFunction::NoPHIs, llvm::yaml::MachineFunction::NoVRegs, printMBB(), llvm::yaml::MachineFunction::RegBankSelected, llvm::yaml::MachineFunction::Selected, llvm::yaml::Output::setWriteDefaultValues(), SimplifyMIR, llvm::Sub, llvm::yaml::MachineFunction::TracksDebugUserValues, llvm::yaml::MachineFunction::UseDebugInstrRef, llvm::MachineFunction::useDebugInstrRef(), llvm::yaml::BlockStringValue::Value, and llvm::yaml::StringValue::Value.

Referenced by llvm::printMIR().

◆ printMI()

◆ printMIOperand()

◆ printRegClassOrBank()

void printRegClassOrBank ( Register Reg,
yaml::StringValue & Dest,
const MachineRegisterInfo & RegInfo,
const TargetRegisterInfo * TRI )
static

Definition at line 267 of file MIRPrinter.cpp.

References llvm::printRegClassOrBank(), Reg, TRI, and llvm::yaml::StringValue::Value.

◆ printRegFlags()

void printRegFlags ( Register Reg,
std::vector< yaml::FlowStringValue > & RegisterFlags,
const MachineFunction & MF,
const TargetRegisterInfo * TRI )
static

Definition at line 290 of file MIRPrinter.cpp.

References Reg, and TRI.

Referenced by convertMRI().

◆ printRegMIR()

◆ printStackObjectDbgInfo()

template<typename T>
void printStackObjectDbgInfo ( const MachineFunction::VariableDbgInfo & DebugVar,
T & Object,
ModuleSlotTracker & MST )
static

◆ printStackObjectReference()

void printStackObjectReference ( raw_ostream & OS,
const MFPrintState & State,
int FrameIndex )
static

Variable Documentation

◆ PrintLocations

cl::opt< bool > PrintLocations("mir-debug-loc", cl::Hidden, cl::init(true), cl::desc("Print MIR debug-locations")) ( "mir-debug-loc" ,
cl::Hidden ,
cl::init(true) ,
cl::desc("Print MIR debug-locations")  )
static

Referenced by printMI().

◆ SimplifyMIR

cl::opt< bool > SimplifyMIR("simplify-mir", cl::Hidden, cl::desc("Leave out unnecessary information when printing MIR")) ( "simplify-mir" ,
cl::Hidden ,
cl::desc("Leave out unnecessary information when printing MIR")  )
static

Referenced by printMBB(), and printMF().