67 : OS(OS), MST(MST), RegisterMaskIds(RegisterMaskIds) {}
82 Mod.
print(OS,
nullptr);
100 else if (Reg < TRI->getNumRegs())
107 initRegisterMaskIds(MF);
120 for (
const auto &MBB : MF) {
125 assert(MBB.getNumber() == I++ &&
126 "Can't print MBBs that aren't sequentially numbered");
129 convert(MST, YamlMBB, MBB);
180 YamlObject.
ID = ID++;
201 YamlObject.
ID = ID++;
220 assert(MBB.
getNumber() >= 0 &&
"Invalid MBB number");
224 YamlMBB.
Name.
Value = BB->hasName() ? BB->getName() :
"<unnamed bb>";
230 for (
const auto *SuccMBB : MBB.
successors()) {
233 MIPrinter(StrOS, MST, RegisterMaskIds).printMBBReference(*SuccMBB);
238 assert(TRI &&
"Expected target register info");
243 YamlMBB.
LiveIns.push_back(StrOS.str());
248 for (
const auto &
MI : MBB) {
250 MIPrinter(StrOS, MST, RegisterMaskIds).print(
MI);
260 RegisterMaskIds.insert(std::make_pair(Mask, I++));
265 const auto *TRI =
SubTarget.getRegisterInfo();
266 assert(TRI &&
"Expected target register info");
268 assert(
TII &&
"Expected target instruction info");
286 bool NeedComma =
false;
299 OS <<
'.' << BB->getName();
308 OS << (Op.
isDef() ?
"implicit-def " :
"implicit ");
324 printMBBReference(*Op.
getMBB());
331 auto RegMaskInfo = RegisterMaskIds.find(Op.
getRegMask());
332 if (RegMaskInfo != RegisterMaskIds.end())
346 Out << const_cast<Module &>(M);
const MachineFunction * getParent() const
getParent - Return the MachineFunction containing this basic block.
std::vector< FlowStringValue > Successors
unsigned getAlignment() const
getAlignment - Return the alignment (log2, not bytes) of the function.
const GlobalValue * getGlobal() const
static StringRef input(StringRef Str, void *Ctxt, Module &Mod)
static unsigned virtReg2Index(unsigned Reg)
virtReg2Index - Convert a virtual register number to a 0-based index.
MachineBasicBlock * getMBB() const
static unsigned index2VirtReg(unsigned Index)
index2VirtReg - Convert a 0-based index to a virtual register number.
int getNumber() const
getNumber - MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a M...
A Module instance is used to store all the information related to an LLVM module. ...
static bool isVirtualRegister(unsigned Reg)
isVirtualRegister - Return true if the specified register number is in the virtual register namespace...
bool hasInlineAsm() const
Returns true if the function contains any inline assembly.
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...
MachineBasicBlock reference.
const Function * getFunction() const
getFunction - Return the LLVM function that this machine code represents
Manage lifetime of a slot tracker for printing IR.
print alias Alias Set Printer
iterator_range< succ_iterator > successors()
void print(raw_ostream &OS, AssemblyAnnotationWriter *AAW, bool ShouldPreserveUseListOrder=false) const
Print the module to an output stream with an optional AssemblyAnnotationWriter.
unsigned getMaxAlignment() const
Return the alignment in bytes that this function must be aligned to, which is greater than the defaul...
Mask of preserved registers.
uint64_t getStackSize() const
Return the number of bytes that must be allocated to hold all of the fixed size frame objects...
livein_iterator livein_begin() const
unsigned getNumVirtRegs() const
getNumVirtRegs - Return the number of virtual registers created.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
const HexagonInstrInfo * TII
Serializable representation of the fixed stack object from the MachineFrameInfo class.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
const TargetRegisterClass * getRegClass(unsigned Reg) const
getRegClass - Return the register class of the specified virtual register.
Reg
All possible values of the reg field in the ModR/M byte.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
bool isFrameAddressTaken() const
This method may be called any time after instruction selection is complete to determine if there is a...
unsigned getNumOperands() const
Access to explicit operands of the instruction.
bool isVariableSizedObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a variable sized object.
int getObjectIndexBegin() const
Return the minimum frame object index.
std::vector< VirtualRegisterDefinition > VirtualRegisters
int getOffsetAdjustment() const
Return the correction for frame offsets.
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.
bool TracksSubRegLiveness
bool HasMustTailInVarArgFunc
const char * getRegClassName(const TargetRegisterClass *Class) const
getRegClassName - Returns the name of the register class.
bool isImmutableObjectIndex(int ObjectIdx) const
isImmutableObjectIndex - Returns true if the specified index corresponds to an immutable object...
const BasicBlock * getBasicBlock() const
getBasicBlock - Return the LLVM basic block that this instance corresponded to originally.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
bool isSpillSlotObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a spill slot.
const MachineBasicBlock * getParent() const
std::vector< FlowStringValue > LiveIns
bool hasStackMap() const
This method may be called any time after instruction selection is complete to determine if there is a...
Address of a global value.
Serializable representation of stack object from the MachineFrameInfo class.
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...
livein_iterator livein_end() const
const MachineOperand & getOperand(unsigned i) const
bool hasVAStart() const
Returns true if the function calls the llvm.va_start intrinsic.
bool tracksLiveness() const
tracksLiveness - Returns true when tracking register liveness accurately.
virtual ArrayRef< const char * > getRegMaskNames() const =0
unsigned MaxCallFrameSize
std::vector< MachineStackObject > StackObjects
Serializable representation of MachineFrameInfo.
bool subRegLivenessEnabled() const
static void printReg(unsigned Reg, raw_ostream &OS, const TargetRegisterInfo *TRI)
void printMIR(raw_ostream &OS, const Module &M)
Print LLVM IR using the MIR serialization format to the given output stream.
unsigned getSubReg() const
The Output class is used to generate a yaml document from in-memory structs and vectors.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
bool isDeadObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a dead object.
bool hasCalls() const
Return true if the current function has any function calls.
const uint32_t * getRegMask() const
getRegMask - Returns a bit mask of registers preserved by this RegMask operand.
MachineOperand class - Representation of each machine instruction operand.
unsigned getObjectAlignment(int ObjectIdx) const
Return the alignment of the specified stack object.
Module.h This file contains the declarations for the Module class.
MachineFrameInfo FrameInfo
unsigned getMaxCallFrameSize() const
Return the maximum size of a call frame that must be allocated for an outgoing function call...
MachineFrameInfo * getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
std::vector< MachineBasicBlock > BasicBlocks
bool HasOpaqueSPAdjustment
const char * getSubRegIndexName(unsigned SubIdx) const
getSubRegIndexName - Return the human-readable symbolic target-specific name for the specified SubReg...
std::vector< StringValue > Instructions
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
Representation of each machine instruction.
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
bool hasAddressTaken() const
hasAddressTaken - Test whether this block is potentially the target of an indirect branch...
bool hasPatchPoint() const
This method may be called any time after instruction selection is complete to determine if there is a...
bool isLandingPad() const
isLandingPad - Returns true if the block is a landing pad.
static void output(const Module &Mod, void *Ctxt, raw_ostream &OS)
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
virtual ArrayRef< const uint32_t * > getRegMasks() const =0
Return all the call-preserved register masks defined for this target.
This class should be specialized by type that requires custom conversion to/from a YAML literal block...
bool exposesReturnsTwice() const
exposesReturnsTwice - Returns true if the function calls setjmp or any other similar functions with a...
bool IsReturnAddressTaken
unsigned getReg() const
getReg - Returns the register number.
std::vector< FixedMachineStackObject > FixedStackObjects
A raw_ostream that writes to an std::string.
Module * getParent()
Get the module that this global value is contained inside of...
This class implements an extremely fast bulk output stream that can only output to a stream...
bool hasOpaqueSPAdjustment() const
Returns true if the function contains opaque dynamic stack adjustments.
const char * getName(unsigned RegNo) const
Return the human-readable symbolic target-specific name for the specified physical register...
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
StringRef - Represent a constant reference to a string, i.e.
int getObjectIndexEnd() const
Return one past the maximum frame object index.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
std::string lower() const
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
bool hasMustTailInVarArgFunc() const
Returns true if the function is variadic and contains a musttail call.
unsigned getAlignment() const
getAlignment - Return alignment of the basic block.