LLVM: lib/CodeGen/MIRPrinter.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

54#include

55#include

56#include

57#include

58#include

59#include

60#include

61#include

62

63using namespace llvm;

64

67 cl::desc("Leave out unnecessary information when printing MIR"));

68

70 cl::desc("Print MIR debug-locations"));

71

73

74namespace {

75

76

77struct FrameIndexOperand {

78 std::string Name;

79 unsigned ID;

80 bool IsFixed;

81

82 FrameIndexOperand(StringRef Name, unsigned ID, bool IsFixed)

83 : Name(Name.str()), ID(ID), IsFixed(IsFixed) {}

84

85

86 static FrameIndexOperand create(StringRef Name, unsigned ID) {

87 return FrameIndexOperand(Name, ID, false);

88 }

89

90

91 static FrameIndexOperand createFixed(unsigned ID) {

92 return FrameIndexOperand("", ID, true);

93 }

94};

95

96}

97

98namespace llvm {

99

100

101

106

107

109

110public:

112 : OS(OS), MMI(MMI) {}

113

115

139

140private:

142};

143

144

145

151

153

156

157public:

161 : OS(OS), MST(MST), RegisterMaskIds(RegisterMaskIds),

162 StackObjectOperandMapping(StackObjectOperandMapping) {}

163

165

170 bool ShouldPrintRegisterTies, LLT TypeToPrint,

171 bool PrintDef = true);

172};

173

174}

175

176namespace llvm {

177namespace yaml {

178

179

180template <> struct BlockScalarTraits<Module> {

182 Mod.print(OS, nullptr);

183 }

184

186 llvm_unreachable("LLVM Module is supposed to be parsed separately");

187 return "";

188 }

189};

190

191}

192}

193

198}

199

201 initRegisterMaskIds(MF);

202

208

217

230

237

246 const auto &SubSrc = Sub.Src;

247 const auto &SubDest = Sub.Dest;

249 SubDest.first,

250 SubDest.second,

251 Sub.Subreg});

252 }

257

260 std::unique_ptryaml::MachineFunctionInfo(TM.convertFuncInfoToYAML(MF));

261

263 bool IsNewlineNeeded = false;

264 for (const auto &MBB : MF) {

265 if (IsNewlineNeeded)

266 StrOS << "\n";

267 MIPrinter(StrOS, MST, RegisterMaskIds, StackObjectOperandMapping)

269 IsNewlineNeeded = true;

270 }

271

272

274

276

277 yaml::Output Out(OS);

279 Out.setWriteDefaultValues(true);

280 Out << YamlMF;

281}

282

285 assert(RegMask && "Can't print an empty register mask");

287

288 bool IsRegInRegMaskFound = false;

289 for (int I = 0, E = TRI->getNumRegs(); I < E; I++) {

290

291 if (RegMask[I / 32] & (1u << (I % 32))) {

292 if (IsRegInRegMaskFound)

293 OS << ',';

295 IsRegInRegMaskFound = true;

296 }

297 }

298

299 OS << ')';

300}

301

307}

308

309template

310static void

313 std::array<std::string *, 3> Outputs{{&Object.DebugVar.Value,

314 &Object.DebugExpr.Value,

315 &Object.DebugLoc.Value}};

316 std::array<const Metadata *, 3> Metas{{DebugVar.Var,

317 DebugVar.Expr,

318 DebugVar.Loc}};

319 for (unsigned i = 0; i < 3; ++i) {

321 Metas[i]->printAsOperand(StrOS, MST);

322 }

323}

324

326 std::vectoryaml::FlowStringValue &RegisterFlags,

329 auto FlagValues = TRI->getVRegFlagsOfReg(Reg, MF);

330 for (auto &Flag : FlagValues) {

332 }

333}

334

340

341

345 VReg.ID = I;

347 continue;

350 if (PreferredReg)

354 }

355

356

357 for (std::pair<MCRegister, Register> LI : RegInfo.liveins()) {

360 if (LI.second)

362 YamlMF.LiveIns.push_back(std::move(LiveIn));

363 }

364

365

368 std::vectoryaml::FlowStringValue CalleeSavedRegisters;

369 for (const MCPhysReg *I = CalleeSavedRegs; *I; ++I) {

372 CalleeSavedRegisters.push_back(std::move(Reg));

373 }

375 }

376}

377

403 }

407 }

408}

409

418 MCRegister EntryValReg = DebugVar.getEntryValueRegister();

420 }

421}

422

428

429

433 if (BeginIdx < 0)

434 FixedStackObjectsIdx.reserve(-BeginIdx);

435

436 unsigned ID = 0;

437 for (int I = BeginIdx; I < 0; ++I, ++ID) {

438 FixedStackObjectsIdx.push_back(-1);

440 continue;

441

443 YamlObject.ID = ID;

453

456 StackObjectOperandMapping.insert(

457 std::make_pair(I, FrameIndexOperand::createFixed(ID)));

458 }

459

460

464 if (EndIdx > 0)

465 StackObjectsIdx.reserve(EndIdx);

466 ID = 0;

467 for (int I = 0; I < EndIdx; ++I, ++ID) {

468 StackObjectsIdx.push_back(-1);

470 continue;

471

473 YamlObject.ID = ID;

475 YamlObject.Name.Value = std::string(

476 Alloca->hasName() ? Alloca->getName() : "");

486

487

490 StackObjectOperandMapping.insert(std::make_pair(

491 I, FrameIndexOperand::create(YamlObject.Name.Value, ID)));

492 }

493

495 const int FrameIdx = CSInfo.getFrameIdx();

497 continue;

498

501 if (!CSInfo.isSpilledToReg()) {

504 "Invalid stack object index");

505 if (FrameIdx < 0) {

506 auto &Object =

509 Object.CalleeSavedRegister = Reg;

510 Object.CalleeSavedRestored = CSInfo.isRestored();

511 } else {

512 auto &Object = YMF.StackObjects[StackObjectsIdx[FrameIdx]];

513 Object.CalleeSavedRegister = Reg;

514 Object.CalleeSavedRestored = CSInfo.isRestored();

515 }

516 }

517 }

520 assert(LocalObject.first >= 0 && "Expected a locally mapped stack object");

521 YMF.StackObjects[StackObjectsIdx[LocalObject.first]].LocalOffset =

522 LocalObject.second;

523 }

524

525

526

529 MIPrinter(StrOS, MST, RegisterMaskIds, StackObjectOperandMapping)

531 }

532

535 MIPrinter(StrOS, MST, RegisterMaskIds, StackObjectOperandMapping)

537 }

538

539

542 int Idx = DebugVar.getStackSlot();

544 "Invalid stack object index");

545 if (Idx < 0) {

546 auto &Object =

550 } else {

553 }

554 }

555}

556

564

565

567 CallLocation.BlockNum = CallI->getParent()->getNumber();

568

569 CallLocation.Offset =

570 std::distance(CallI->getParent()->instr_begin(), CallI);

572

573 for (auto ArgReg : CSInfo.second.ArgRegPairs) {

575 YmlArgReg.ArgNo = ArgReg.ArgNo;

578 }

580 }

581

582

585 if (A.CallLocation.BlockNum == B.CallLocation.BlockNum)

586 return A.CallLocation.Offset < B.CallLocation.Offset;

587 return A.CallLocation.BlockNum < B.CallLocation.BlockNum;

588 });

589}

590

596 for (auto &MD : MDList) {

597 std::string NS;

601 }

602}

603

610 CallSite.Offset = std::distance(CallInst->getParent()->instr_begin(),

612

614 CG.TargetFlags};

616 }

617

618

621 if (A.CallSite.BlockNum == B.CallSite.BlockNum)

622 return A.CallSite.Offset < B.CallSite.Offset;

623 return A.CallSite.BlockNum < B.CallSite.BlockNum;

624 });

625}

626

629 unsigned ID = 0;

631 std::string Str;

633 if (Constant.isMachineConstantPoolEntry()) {

635 } else {

637 }

638

640 YamlConstant.ID = ID++;

641 YamlConstant.Value = Str;

644

645 MF.Constants.push_back(YamlConstant);

646 }

647}

648

653 unsigned ID = 0;

655 std::string Str;

657 Entry.ID = ID++;

658 for (const auto *MBB : Table.MBBs) {

661 Entry.Blocks.push_back(Str);

662 Str.clear();

663 }

664 YamlJTI.Entries.push_back(Entry);

665 }

666}

667

668void MIRPrinter::initRegisterMaskIds(const MachineFunction &MF) {

670 unsigned I = 0;

671 for (const uint32_t *Mask : TRI->getRegMasks())

672 RegisterMaskIds.insert(std::make_pair(Mask, I++));

673}

674

677 bool &IsFallthrough) {

679

681 if (MI.isPHI())

682 continue;

684 if (!MO.isMBB())

685 continue;

687 auto RP = Seen.insert(Succ);

688 if (RP.second)

689 Result.push_back(Succ);

690 }

691 }

693 IsFallthrough = I == MBB.end() || I->isBarrier();

694}

695

696bool

697MIPrinter::canPredictBranchProbabilities(const MachineBasicBlock &MBB) const {

699 return true;

701 return true;

702

704 MBB.Probs.end());

706 Normalized.end());

709

710 return std::equal(Normalized.begin(), Normalized.end(), Equal.begin());

711}

712

715 bool GuessedFallthrough;

717 if (GuessedFallthrough) {

720 if (NextI != MF.end()) {

724 }

725 }

727 return false;

729}

730

736 &MST);

737 OS << ":\n";

738

739 bool HasLineAttributes = false;

740

741 bool canPredictProbs = canPredictBranchProbabilities(MBB);

742

743

744

745

746

747

749 !canPredictSuccessors(MBB)) {

750 OS.indent(2) << "successors:";

752 OS << " ";

755 OS << ", ";

758 OS << '('

760 << ')';

761 }

762 OS << "\n";

763 HasLineAttributes = true;

764 }

765

766

770 OS.indent(2) << "liveins: ";

771 bool First = true;

774 OS << ", ";

777 if (!LI.LaneMask.all())

779 }

780 OS << "\n";

781 HasLineAttributes = true;

782 }

783

784 if (HasLineAttributes && MBB.empty())

785 OS << "\n";

786 bool IsInBundle = false;

788 if (IsInBundle && MI.isInsideBundle()) {

789 OS.indent(2) << "}\n";

790 IsInBundle = false;

791 }

792 OS.indent(IsInBundle ? 4 : 2);

795 OS << " {";

796 IsInBundle = true;

797 }

798 OS << "\n";

799 }

800 if (IsInBundle)

801 OS.indent(2) << "}\n";

802}

803

805 const auto *MF = MI.getMF();

808 const auto *TRI = SubTarget.getRegisterInfo();

809 assert(TRI && "Expected target register info");

810 const auto *TII = SubTarget.getInstrInfo();

811 assert(TII && "Expected target instruction info");

812 if (MI.isCFIInstruction())

813 assert(MI.getNumOperands() == 1 && "Expected 1 operand in CFI instruction");

814

816 bool ShouldPrintRegisterTies = MI.hasComplexRegisterTies();

817 unsigned I = 0, E = MI.getNumOperands();

818 for (; I < E && MI.getOperand(I).isReg() && MI.getOperand(I).isDef() &&

819 MI.getOperand(I).isImplicit();

820 ++I) {

821 if (I)

822 OS << ", ";

824 MI.getTypeToPrint(I, PrintedTypes, MRI),

825 false);

826 }

827

828 if (I)

829 OS << " = ";

831 OS << "frame-setup ";

833 OS << "frame-destroy ";

835 OS << "nnan ";

837 OS << "ninf ";

839 OS << "nsz ";

841 OS << "arcp ";

843 OS << "contract ";

845 OS << "afn ";

847 OS << "reassoc ";

849 OS << "nuw ";

851 OS << "nsw ";

853 OS << "exact ";

855 OS << "nofpexcept ";

857 OS << "nomerge ";

859 OS << "unpredictable ";

861 OS << "noconvergent ";

863 OS << "nneg ";

865 OS << "disjoint ";

867 OS << "nusw ";

869 OS << "samesign ";

870

871 OS << TII->getName(MI.getOpcode());

872 if (I < E)

873 OS << ' ';

874

875 bool NeedComma = false;

876 for (; I < E; ++I) {

877 if (NeedComma)

878 OS << ", ";

880 MI.getTypeToPrint(I, PrintedTypes, MRI));

881 NeedComma = true;

882 }

883

884

885

886 if (MCSymbol *PreInstrSymbol = MI.getPreInstrSymbol()) {

887 if (NeedComma)

888 OS << ',';

889 OS << " pre-instr-symbol ";

891 NeedComma = true;

892 }

893 if (MCSymbol *PostInstrSymbol = MI.getPostInstrSymbol()) {

894 if (NeedComma)

895 OS << ',';

896 OS << " post-instr-symbol ";

898 NeedComma = true;

899 }

900 if (MDNode *HeapAllocMarker = MI.getHeapAllocMarker()) {

901 if (NeedComma)

902 OS << ',';

903 OS << " heap-alloc-marker ";

904 HeapAllocMarker->printAsOperand(OS, MST);

905 NeedComma = true;

906 }

907 if (MDNode *PCSections = MI.getPCSections()) {

908 if (NeedComma)

909 OS << ',';

910 OS << " pcsections ";

911 PCSections->printAsOperand(OS, MST);

912 NeedComma = true;

913 }

914 if (MDNode *MMRA = MI.getMMRAMetadata()) {

915 if (NeedComma)

916 OS << ',';

917 OS << " mmra ";

918 MMRA->printAsOperand(OS, MST);

919 NeedComma = true;

920 }

921 if (uint32_t CFIType = MI.getCFIType()) {

922 if (NeedComma)

923 OS << ',';

924 OS << " cfi-type " << CFIType;

925 NeedComma = true;

926 }

927

928 if (auto Num = MI.peekDebugInstrNum()) {

929 if (NeedComma)

930 OS << ',';

931 OS << " debug-instr-number " << Num;

932 NeedComma = true;

933 }

934

937 if (NeedComma)

938 OS << ',';

939 OS << " debug-location ";

941 }

942 }

943

944 if (MI.memoperands_empty()) {

945 OS << " :: ";

948 bool NeedComma = false;

949 for (const auto *Op : MI.memoperands()) {

950 if (NeedComma)

951 OS << ", ";

952 Op->print(OS, MST, SSNs, Context, &MFI, TII);

953 NeedComma = true;

954 }

955 }

956}

957

959 auto ObjectInfo = StackObjectOperandMapping.find(FrameIndex);

960 assert(ObjectInfo != StackObjectOperandMapping.end() &&

961 "Invalid frame index");

962 const FrameIndexOperand &Operand = ObjectInfo->second;

964 Operand.Name);

965}

966

968 if (Comment.empty())

969 return Comment;

970 return std::string(" /* " + Comment + " */");

971}

972

976 bool ShouldPrintRegisterTies, LLT TypeToPrint,

977 bool PrintDef) {

979 std::string MOComment = TII->createMIROperandComment(MI, Op, OpIdx, TRI);

980

981 switch (Op.getType()) {

983 if (MI.isOperandSubregIdx(OpIdx)) {

986 break;

987 }

988 [[fallthrough]];

1007 unsigned TiedOperandIdx = 0;

1008 if (ShouldPrintRegisterTies && Op.isReg() && Op.isTied() && Op.isDef())

1009 TiedOperandIdx = Op.getParent()->findTiedOperandIdx(OpIdx);

1011 Op.print(OS, MST, TypeToPrint, OpIdx, PrintDef, false,

1012 ShouldPrintRegisterTies, TiedOperandIdx, TRI, TII);

1014 break;

1015 }

1018 break;

1020 auto RegMaskInfo = RegisterMaskIds.find(Op.getRegMask());

1021 if (RegMaskInfo != RegisterMaskIds.end())

1022 OS << StringRef(TRI->getRegMaskNames()[RegMaskInfo->second]).lower();

1023 else

1025 break;

1026 }

1027 }

1028}

1029

1032 if (isa(V)) {

1033 V.printAsOperand(OS, false, MST);

1034 return;

1035 }

1036 if (isa(V)) {

1037

1038 OS << '`';

1039 V.printAsOperand(OS, true, MST);

1040 OS << '`';

1041 return;

1042 }

1043 OS << "%ir.";

1044 if (V.hasName()) {

1046 return;

1047 }

1050}

1051

1055

1056 yaml::Output Out(OS);

1057 Out << const_cast<Module &>(M);

1058}

1059

1062

1063

1066

1069}

unsigned const MachineRegisterInfo * MRI

MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL

static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")

static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")

dxil pretty DXIL Metadata Pretty Printer

Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx

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.

cl::opt< bool > WriteNewDbgInfoFormat

A common definition of LaneBitmask for use in TableGen and CodeGen.

Implement a low-level type suitable for MachineInstr level instruction selection.

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

static void printRegMIR(unsigned Reg, yaml::StringValue &Dest, const TargetRegisterInfo *TRI)

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

cl::opt< bool > WriteNewDbgInfoFormat

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 cl::opt< bool > SimplifyMIR("simplify-mir", cl::Hidden, cl::desc("Leave out unnecessary information when printing MIR"))

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

This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...

unsigned const TargetRegisterInfo * TRI

static bool isReg(const MCInst &MI, unsigned OpNo)

if(auto Err=PB.parsePassPipeline(MPM, Passes)) return wrap(std MPM run * Mod

assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())

This file implements the SmallBitVector class.

This file defines the SmallPtrSet class.

This file defines the SmallVector class.

uint32_t getNumerator() const

static void normalizeProbabilities(ProbabilityIter Begin, ProbabilityIter End)

This class represents a function call, abstracting a target machine's calling convention.

This is an important base class in LLVM.

This class represents an Operation in the Expression.

bool print(raw_ostream &OS, DIDumpOptions DumpOpts, const DWARFExpression *Expr, DWARFUnit *U) const

iterator find(const_arg_type_t< KeyT > Val)

std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)

LLVMContext & getContext() const

getContext - Return a reference to the LLVMContext associated with this function.

Module * getParent()

Get the module that this global value is contained inside of...

This is an important class for using LLVM in a threaded context.

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 ...

This class prints out the machine instructions using the MIR serialization format.

void print(const MachineBasicBlock &MBB)

MIPrinter(raw_ostream &OS, ModuleSlotTracker &MST, const DenseMap< const uint32_t *, unsigned > &RegisterMaskIds, const DenseMap< int, FrameIndexOperand > &StackObjectOperandMapping)

void printStackObjectReference(int FrameIndex)

static void printIRValue(raw_ostream &OS, const Value &V, ModuleSlotTracker &MST)

Helper functions to print IR value as MIR serialization format which will be useful for target specif...

This class prints out the machine functions using the MIR serialization format.

MIRPrinter(raw_ostream &OS, const MachineModuleInfo &MMI)

void convertCalledGlobals(yaml::MachineFunction &YMF, const MachineFunction &MF, MachineModuleSlotTracker &MST)

void convertEntryValueObjects(yaml::MachineFunction &YMF, const MachineFunction &MF, ModuleSlotTracker &MST)

void convertCallSiteObjects(yaml::MachineFunction &YMF, const MachineFunction &MF, ModuleSlotTracker &MST)

void print(const MachineFunction &MF)

void convert(yaml::MachineFunction &YamlMF, const MachineFunction &MF, const MachineRegisterInfo &RegInfo, const TargetRegisterInfo *TRI)

void convertMachineMetadataNodes(yaml::MachineFunction &YMF, const MachineFunction &MF, MachineModuleSlotTracker &MST)

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

BranchProbability getSuccProbability(const_succ_iterator Succ) const

Return probability of the edge from this block to MBB.

int getNumber() const

MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...

@ PrintNameIr

Add IR name where available.

@ PrintNameAttributes

Print attributes.

succ_iterator succ_begin()

bool livein_empty() const

void printAsOperand(raw_ostream &OS, bool PrintType=true) const

unsigned succ_size() const

iterator_range< livein_iterator > liveins_dbg() const

bool hasSuccessorProbabilities() const

Return true if any of the successors have probabilities attached to them.

iterator getLastNonDebugInstr(bool SkipPseudoOp=true)

Returns an iterator to the last non-debug instruction in the basic block, or end().

Instructions::const_iterator const_instr_iterator

const MachineFunction * getParent() const

Return the MachineFunction containing this basic block.

void printName(raw_ostream &os, unsigned printNameFlags=PrintNameIr, ModuleSlotTracker *moduleSlotTracker=nullptr) const

Print the basic block's name as:

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...

Align getMaxAlign() const

Return the alignment in bytes that this function must be aligned to, which is greater than the defaul...

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.

MachineBasicBlock * getRestorePoint() const

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

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.

bool isDeadObjectIndex(int ObjectIdx) const

Returns true if the specified index corresponds to a dead object.

MachineBasicBlock * getSavePoint() const

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...

bool hasProperty(Property P) const

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 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 hasEHCatchret() const

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.

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.

void collectMachineMDNodes(MachineMDNodeListType &L) const

MachineOperand class - Representation of each machine instruction operand.

static void printStackObjectReference(raw_ostream &OS, unsigned FrameIndex, bool IsFixed, StringRef Name)

Print a stack object reference.

static void printSubRegIdx(raw_ostream &OS, uint64_t Index, const TargetRegisterInfo *TRI)

Print a subreg index operand.

static void printTargetFlags(raw_ostream &OS, const MachineOperand &Op)

Print operand target flags.

static void printIRSlotNumber(raw_ostream &OS, int Slot)

Print an IRSlotNumber.

static 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_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,...

Register getSimpleHint(Register VReg) const

getSimpleHint - same as getRegAllocationHint except it will only return a target independent hint.

bool tracksLiveness() const

tracksLiveness - Returns true when tracking register liveness accurately.

bool isUpdatedCSRsInitialized() const

Returns true if the updated CSR list was initialized and false otherwise.

ArrayRef< std::pair< MCRegister, Register > > liveins() const

const MCPhysReg * getCalleeSavedRegs() const

Returns list of callee saved registers.

unsigned getNumVirtRegs() const

getNumVirtRegs - Return the number of virtual registers created.

StringRef getVRegName(Register Reg) const

Manage lifetime of a slot tracker for printing IR.

std::vector< std::pair< unsigned, const MDNode * > > MachineMDNodeListType

int getLocalSlot(const Value *V)

Return the slot number of the specified local value.

const Function * getCurrentFunction() const

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.

Used to temporarily set the debug info format of a function, module, or basic block for the duration ...

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.

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.

StringRef - Represent a constant reference to a string, i.e.

std::string lower() const

TargetInstrInfo - Interface to description of machine instruction set.

TargetIntrinsicInfo - Interface to description of machine instruction set.

Primary interface to the complete machine description for the target machine.

TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...

virtual const TargetRegisterInfo * getRegisterInfo() const

getRegisterInfo - If register information is available, return it.

LLVM Value Representation.

void print(raw_ostream &O, bool IsForDebug=false) const

Implement operator<< on Value.

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.

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.

#define llvm_unreachable(msg)

Marks that the current location is not supposed to be reachable.

unsigned ID

LLVM IR allows to use arbitrary numbers as calling convention identifiers.

initializer< Ty > init(const Ty &Val)

This is an optimization pass for GlobalISel generic memory operations.

Printable PrintLaneMask(LaneBitmask LaneMask)

Create Printable object to print LaneBitmasks on a raw_ostream.

void printMIR(raw_ostream &OS, const Module &M)

Print LLVM IR using the MIR serialization format to the given output stream.

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...

void sort(IteratorTy Start, IteratorTy End)

Printable printRegClassOrBank(Register Reg, const MachineRegisterInfo &RegInfo, const TargetRegisterInfo *TRI)

Create Printable object to print register classes or register banks on a raw_ostream.

format_object< Ts... > format(const char *Fmt, const Ts &... Vals)

These are helper functions used to produce formatted output.

@ First

Helpers to iterate all locations in the MemoryEffectsBase class.

bool is_contained(R &&Range, const E &Element)

Returns true if Element is found in Range.

void printLLVMNameWithoutPrefix(raw_ostream &OS, StringRef Name)

Print out a name of an LLVM value without any prefixes.

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.

Printable printMBBReference(const MachineBasicBlock &MBB)

Prints a machine basic block reference.

uint64_t value() const

This is a hole in the type system and should not be abused.

static void output(const Module &Mod, void *Ctxt, raw_ostream &OS)

static StringRef input(StringRef Str, void *Ctxt, Module &Mod)

Serializable representation of CallSiteInfo.

std::vector< ArgRegPair > ArgForwardingRegs

MachineInstrLoc CallLocation

Serializable representation of the MCRegister variant of MachineFunction::VariableDbgInfo.

StringValue EntryValueRegister

Serializable representation of the fixed stack object from the MachineFrameInfo class.

TargetStackID::Value StackID

Serializable representation of MachineFrameInfo.

bool IsCalleeSavedInfoValid

unsigned MaxCallFrameSize

~0u means: not computed yet.

StringValue StackProtector

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

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 > RegisterFlags

StringValue PreferredRegister