LLVM  16.0.0git
MIRPrinter.cpp
Go to the documentation of this file.
1 //===- MIRPrinter.cpp - MIR serialization format printer ------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the class that prints out the LLVM IR and machine
10 // functions using the MIR serialization format.
11 //
12 //===----------------------------------------------------------------------===//
13 
15 #include "llvm/ADT/DenseMap.h"
16 #include "llvm/ADT/STLExtras.h"
18 #include "llvm/ADT/SmallPtrSet.h"
19 #include "llvm/ADT/SmallVector.h"
20 #include "llvm/ADT/StringRef.h"
37 #include "llvm/IR/DebugLoc.h"
38 #include "llvm/IR/Function.h"
40 #include "llvm/IR/Instructions.h"
41 #include "llvm/IR/Module.h"
43 #include "llvm/IR/Value.h"
44 #include "llvm/MC/LaneBitmask.h"
46 #include "llvm/Support/Casting.h"
49 #include "llvm/Support/Format.h"
54 #include <algorithm>
55 #include <cassert>
56 #include <cinttypes>
57 #include <cstdint>
58 #include <iterator>
59 #include <string>
60 #include <utility>
61 #include <vector>
62 
63 using namespace llvm;
64 
66  "simplify-mir", cl::Hidden,
67  cl::desc("Leave out unnecessary information when printing MIR"));
68 
69 static cl::opt<bool> PrintLocations("mir-debug-loc", cl::Hidden, cl::init(true),
70  cl::desc("Print MIR debug-locations"));
71 
72 namespace {
73 
74 /// This structure describes how to print out stack object references.
75 struct FrameIndexOperand {
76  std::string Name;
77  unsigned ID;
78  bool IsFixed;
79 
80  FrameIndexOperand(StringRef Name, unsigned ID, bool IsFixed)
81  : Name(Name.str()), ID(ID), IsFixed(IsFixed) {}
82 
83  /// Return an ordinary stack object reference.
84  static FrameIndexOperand create(StringRef Name, unsigned ID) {
85  return FrameIndexOperand(Name, ID, /*IsFixed=*/false);
86  }
87 
88  /// Return a fixed stack object reference.
89  static FrameIndexOperand createFixed(unsigned ID) {
90  return FrameIndexOperand("", ID, /*IsFixed=*/true);
91  }
92 };
93 
94 } // end anonymous namespace
95 
96 namespace llvm {
97 
98 /// This class prints out the machine functions using the MIR serialization
99 /// format.
100 class MIRPrinter {
101  raw_ostream &OS;
102  DenseMap<const uint32_t *, unsigned> RegisterMaskIds;
103  /// Maps from stack object indices to operand indices which will be used when
104  /// printing frame index machine operands.
105  DenseMap<int, FrameIndexOperand> StackObjectOperandMapping;
106 
107 public:
108  MIRPrinter(raw_ostream &OS) : OS(OS) {}
109 
110  void print(const MachineFunction &MF);
111 
112  void convert(yaml::MachineFunction &MF, const MachineRegisterInfo &RegInfo,
113  const TargetRegisterInfo *TRI);
115  const MachineFrameInfo &MFI);
119  const MachineJumpTableInfo &JTI);
121  const MachineFunction &MF, ModuleSlotTracker &MST);
123  const MachineFunction &MF,
124  ModuleSlotTracker &MST);
126  const MachineFunction &MF,
128 
129 private:
130  void initRegisterMaskIds(const MachineFunction &MF);
131 };
132 
133 /// This class prints out the machine instructions using the MIR serialization
134 /// format.
135 class MIPrinter {
136  raw_ostream &OS;
137  ModuleSlotTracker &MST;
138  const DenseMap<const uint32_t *, unsigned> &RegisterMaskIds;
139  const DenseMap<int, FrameIndexOperand> &StackObjectOperandMapping;
140  /// Synchronization scope names registered with LLVMContext.
142 
143  bool canPredictBranchProbabilities(const MachineBasicBlock &MBB) const;
144  bool canPredictSuccessors(const MachineBasicBlock &MBB) const;
145 
146 public:
148  const DenseMap<const uint32_t *, unsigned> &RegisterMaskIds,
149  const DenseMap<int, FrameIndexOperand> &StackObjectOperandMapping)
150  : OS(OS), MST(MST), RegisterMaskIds(RegisterMaskIds),
151  StackObjectOperandMapping(StackObjectOperandMapping) {}
152 
153  void print(const MachineBasicBlock &MBB);
154 
155  void print(const MachineInstr &MI);
157  void print(const MachineInstr &MI, unsigned OpIdx,
158  const TargetRegisterInfo *TRI, const TargetInstrInfo *TII,
159  bool ShouldPrintRegisterTies, LLT TypeToPrint,
160  bool PrintDef = true);
161 };
162 
163 } // end namespace llvm
164 
165 namespace llvm {
166 namespace yaml {
167 
168 /// This struct serializes the LLVM IR module.
169 template <> struct BlockScalarTraits<Module> {
170  static void output(const Module &Mod, void *Ctxt, raw_ostream &OS) {
171  Mod.print(OS, nullptr);
172  }
173 
174  static StringRef input(StringRef Str, void *Ctxt, Module &Mod) {
175  llvm_unreachable("LLVM Module is supposed to be parsed separately");
176  return "";
177  }
178 };
179 
180 } // end namespace yaml
181 } // end namespace llvm
182 
183 static void printRegMIR(unsigned Reg, yaml::StringValue &Dest,
184  const TargetRegisterInfo *TRI) {
185  raw_string_ostream OS(Dest.Value);
186  OS << printReg(Reg, TRI);
187 }
188 
190  initRegisterMaskIds(MF);
191 
192  yaml::MachineFunction YamlMF;
193  YamlMF.Name = MF.getName();
194  YamlMF.Alignment = MF.getAlignment();
196  YamlMF.HasWinCFI = MF.hasWinCFI();
197 
198  YamlMF.CallsEHReturn = MF.callsEHReturn();
199  YamlMF.CallsUnwindInit = MF.callsUnwindInit();
200  YamlMF.HasEHCatchret = MF.hasEHCatchret();
201  YamlMF.HasEHScopes = MF.hasEHScopes();
202  YamlMF.HasEHFunclets = MF.hasEHFunclets();
203 
204  YamlMF.Legalized = MF.getProperties().hasProperty(
208  YamlMF.Selected = MF.getProperties().hasProperty(
210  YamlMF.FailedISel = MF.getProperties().hasProperty(
216 
217  convert(YamlMF, MF.getRegInfo(), MF.getSubtarget().getRegisterInfo());
218  MachineModuleSlotTracker MST(&MF);
220  convert(MST, YamlMF.FrameInfo, MF.getFrameInfo());
221  convertStackObjects(YamlMF, MF, MST);
222  convertCallSiteObjects(YamlMF, MF, MST);
223  for (const auto &Sub : MF.DebugValueSubstitutions) {
224  const auto &SubSrc = Sub.Src;
225  const auto &SubDest = Sub.Dest;
226  YamlMF.DebugValueSubstitutions.push_back({SubSrc.first, SubSrc.second,
227  SubDest.first,
228  SubDest.second,
229  Sub.Subreg});
230  }
231  if (const auto *ConstantPool = MF.getConstantPool())
232  convert(YamlMF, *ConstantPool);
233  if (const auto *JumpTableInfo = MF.getJumpTableInfo())
234  convert(MST, YamlMF.JumpTableInfo, *JumpTableInfo);
235 
236  const TargetMachine &TM = MF.getTarget();
237  YamlMF.MachineFuncInfo =
238  std::unique_ptr<yaml::MachineFunctionInfo>(TM.convertFuncInfoToYAML(MF));
239 
240  raw_string_ostream StrOS(YamlMF.Body.Value.Value);
241  bool IsNewlineNeeded = false;
242  for (const auto &MBB : MF) {
243  if (IsNewlineNeeded)
244  StrOS << "\n";
245  MIPrinter(StrOS, MST, RegisterMaskIds, StackObjectOperandMapping)
246  .print(MBB);
247  IsNewlineNeeded = true;
248  }
249  StrOS.flush();
250  // Convert machine metadata collected during the print of the machine
251  // function.
252  convertMachineMetadataNodes(YamlMF, MF, MST);
253 
254  yaml::Output Out(OS);
255  if (!SimplifyMIR)
256  Out.setWriteDefaultValues(true);
257  Out << YamlMF;
258 }
259 
260 static void printCustomRegMask(const uint32_t *RegMask, raw_ostream &OS,
261  const TargetRegisterInfo *TRI) {
262  assert(RegMask && "Can't print an empty register mask");
263  OS << StringRef("CustomRegMask(");
264 
265  bool IsRegInRegMaskFound = false;
266  for (int I = 0, E = TRI->getNumRegs(); I < E; I++) {
267  // Check whether the register is asserted in regmask.
268  if (RegMask[I / 32] & (1u << (I % 32))) {
269  if (IsRegInRegMaskFound)
270  OS << ',';
271  OS << printReg(I, TRI);
272  IsRegInRegMaskFound = true;
273  }
274  }
275 
276  OS << ')';
277 }
278 
279 static void printRegClassOrBank(unsigned Reg, yaml::StringValue &Dest,
280  const MachineRegisterInfo &RegInfo,
281  const TargetRegisterInfo *TRI) {
282  raw_string_ostream OS(Dest.Value);
283  OS << printRegClassOrBank(Reg, RegInfo, TRI);
284 }
285 
286 template <typename T>
287 static void
289  T &Object, ModuleSlotTracker &MST) {
290  std::array<std::string *, 3> Outputs{{&Object.DebugVar.Value,
291  &Object.DebugExpr.Value,
292  &Object.DebugLoc.Value}};
293  std::array<const Metadata *, 3> Metas{{DebugVar.Var,
294  DebugVar.Expr,
295  DebugVar.Loc}};
296  for (unsigned i = 0; i < 3; ++i) {
297  raw_string_ostream StrOS(*Outputs[i]);
298  Metas[i]->printAsOperand(StrOS, MST);
299  }
300 }
301 
303  const MachineRegisterInfo &RegInfo,
304  const TargetRegisterInfo *TRI) {
305  MF.TracksRegLiveness = RegInfo.tracksLiveness();
306 
307  // Print the virtual register definitions.
308  for (unsigned I = 0, E = RegInfo.getNumVirtRegs(); I < E; ++I) {
309  unsigned Reg = Register::index2VirtReg(I);
311  VReg.ID = I;
312  if (RegInfo.getVRegName(Reg) != "")
313  continue;
314  ::printRegClassOrBank(Reg, VReg.Class, RegInfo, TRI);
315  unsigned PreferredReg = RegInfo.getSimpleHint(Reg);
316  if (PreferredReg)
317  printRegMIR(PreferredReg, VReg.PreferredRegister, TRI);
318  MF.VirtualRegisters.push_back(VReg);
319  }
320 
321  // Print the live ins.
322  for (std::pair<unsigned, unsigned> LI : RegInfo.liveins()) {
324  printRegMIR(LI.first, LiveIn.Register, TRI);
325  if (LI.second)
326  printRegMIR(LI.second, LiveIn.VirtualRegister, TRI);
327  MF.LiveIns.push_back(LiveIn);
328  }
329 
330  // Prints the callee saved registers.
331  if (RegInfo.isUpdatedCSRsInitialized()) {
332  const MCPhysReg *CalleeSavedRegs = RegInfo.getCalleeSavedRegs();
333  std::vector<yaml::FlowStringValue> CalleeSavedRegisters;
334  for (const MCPhysReg *I = CalleeSavedRegs; *I; ++I) {
336  printRegMIR(*I, Reg, TRI);
337  CalleeSavedRegisters.push_back(Reg);
338  }
339  MF.CalleeSavedRegisters = CalleeSavedRegisters;
340  }
341 }
342 
344  yaml::MachineFrameInfo &YamlMFI,
345  const MachineFrameInfo &MFI) {
348  YamlMFI.HasStackMap = MFI.hasStackMap();
349  YamlMFI.HasPatchPoint = MFI.hasPatchPoint();
350  YamlMFI.StackSize = MFI.getStackSize();
351  YamlMFI.OffsetAdjustment = MFI.getOffsetAdjustment();
352  YamlMFI.MaxAlignment = MFI.getMaxAlign().value();
353  YamlMFI.AdjustsStack = MFI.adjustsStack();
354  YamlMFI.HasCalls = MFI.hasCalls();
356  ? MFI.getMaxCallFrameSize() : ~0u;
360  YamlMFI.HasVAStart = MFI.hasVAStart();
362  YamlMFI.HasTailCall = MFI.hasTailCall();
363  YamlMFI.LocalFrameSize = MFI.getLocalFrameSize();
364  if (MFI.getSavePoint()) {
365  raw_string_ostream StrOS(YamlMFI.SavePoint.Value);
366  StrOS << printMBBReference(*MFI.getSavePoint());
367  }
368  if (MFI.getRestorePoint()) {
369  raw_string_ostream StrOS(YamlMFI.RestorePoint.Value);
370  StrOS << printMBBReference(*MFI.getRestorePoint());
371  }
372 }
373 
375  const MachineFunction &MF,
376  ModuleSlotTracker &MST) {
377  const MachineFrameInfo &MFI = MF.getFrameInfo();
379 
380  // Process fixed stack objects.
381  assert(YMF.FixedStackObjects.empty());
382  SmallVector<int, 32> FixedStackObjectsIdx;
383  const int BeginIdx = MFI.getObjectIndexBegin();
384  if (BeginIdx < 0)
385  FixedStackObjectsIdx.reserve(-BeginIdx);
386 
387  unsigned ID = 0;
388  for (int I = BeginIdx; I < 0; ++I, ++ID) {
389  FixedStackObjectsIdx.push_back(-1); // Fill index for possible dead.
390  if (MFI.isDeadObjectIndex(I))
391  continue;
392 
394  YamlObject.ID = ID;
395  YamlObject.Type = MFI.isSpillSlotObjectIndex(I)
398  YamlObject.Offset = MFI.getObjectOffset(I);
399  YamlObject.Size = MFI.getObjectSize(I);
400  YamlObject.Alignment = MFI.getObjectAlign(I);
401  YamlObject.StackID = (TargetStackID::Value)MFI.getStackID(I);
402  YamlObject.IsImmutable = MFI.isImmutableObjectIndex(I);
403  YamlObject.IsAliased = MFI.isAliasedObjectIndex(I);
404  // Save the ID' position in FixedStackObjects storage vector.
405  FixedStackObjectsIdx[ID] = YMF.FixedStackObjects.size();
406  YMF.FixedStackObjects.push_back(YamlObject);
407  StackObjectOperandMapping.insert(
408  std::make_pair(I, FrameIndexOperand::createFixed(ID)));
409  }
410 
411  // Process ordinary stack objects.
412  assert(YMF.StackObjects.empty());
413  SmallVector<unsigned, 32> StackObjectsIdx;
414  const int EndIdx = MFI.getObjectIndexEnd();
415  if (EndIdx > 0)
416  StackObjectsIdx.reserve(EndIdx);
417  ID = 0;
418  for (int I = 0; I < EndIdx; ++I, ++ID) {
419  StackObjectsIdx.push_back(-1); // Fill index for possible dead.
420  if (MFI.isDeadObjectIndex(I))
421  continue;
422 
423  yaml::MachineStackObject YamlObject;
424  YamlObject.ID = ID;
425  if (const auto *Alloca = MFI.getObjectAllocation(I))
426  YamlObject.Name.Value = std::string(
427  Alloca->hasName() ? Alloca->getName() : "");
428  YamlObject.Type = MFI.isSpillSlotObjectIndex(I)
433  YamlObject.Offset = MFI.getObjectOffset(I);
434  YamlObject.Size = MFI.getObjectSize(I);
435  YamlObject.Alignment = MFI.getObjectAlign(I);
436  YamlObject.StackID = (TargetStackID::Value)MFI.getStackID(I);
437 
438  // Save the ID' position in StackObjects storage vector.
439  StackObjectsIdx[ID] = YMF.StackObjects.size();
440  YMF.StackObjects.push_back(YamlObject);
441  StackObjectOperandMapping.insert(std::make_pair(
442  I, FrameIndexOperand::create(YamlObject.Name.Value, ID)));
443  }
444 
445  for (const auto &CSInfo : MFI.getCalleeSavedInfo()) {
446  const int FrameIdx = CSInfo.getFrameIdx();
447  if (!CSInfo.isSpilledToReg() && MFI.isDeadObjectIndex(FrameIdx))
448  continue;
449 
451  printRegMIR(CSInfo.getReg(), Reg, TRI);
452  if (!CSInfo.isSpilledToReg()) {
453  assert(FrameIdx >= MFI.getObjectIndexBegin() &&
454  FrameIdx < MFI.getObjectIndexEnd() &&
455  "Invalid stack object index");
456  if (FrameIdx < 0) { // Negative index means fixed objects.
457  auto &Object =
459  [FixedStackObjectsIdx[FrameIdx + MFI.getNumFixedObjects()]];
460  Object.CalleeSavedRegister = Reg;
461  Object.CalleeSavedRestored = CSInfo.isRestored();
462  } else {
463  auto &Object = YMF.StackObjects[StackObjectsIdx[FrameIdx]];
464  Object.CalleeSavedRegister = Reg;
465  Object.CalleeSavedRestored = CSInfo.isRestored();
466  }
467  }
468  }
469  for (unsigned I = 0, E = MFI.getLocalFrameObjectCount(); I < E; ++I) {
470  auto LocalObject = MFI.getLocalFrameObjectMap(I);
471  assert(LocalObject.first >= 0 && "Expected a locally mapped stack object");
472  YMF.StackObjects[StackObjectsIdx[LocalObject.first]].LocalOffset =
473  LocalObject.second;
474  }
475 
476  // Print the stack object references in the frame information class after
477  // converting the stack objects.
478  if (MFI.hasStackProtectorIndex()) {
480  MIPrinter(StrOS, MST, RegisterMaskIds, StackObjectOperandMapping)
482  }
483 
484  if (MFI.hasFunctionContextIndex()) {
486  MIPrinter(StrOS, MST, RegisterMaskIds, StackObjectOperandMapping)
488  }
489 
490  // Print the debug variable information.
491  for (const MachineFunction::VariableDbgInfo &DebugVar :
492  MF.getVariableDbgInfo()) {
493  assert(DebugVar.Slot >= MFI.getObjectIndexBegin() &&
494  DebugVar.Slot < MFI.getObjectIndexEnd() &&
495  "Invalid stack object index");
496  if (DebugVar.Slot < 0) { // Negative index means fixed objects.
497  auto &Object =
498  YMF.FixedStackObjects[FixedStackObjectsIdx[DebugVar.Slot +
499  MFI.getNumFixedObjects()]];
500  printStackObjectDbgInfo(DebugVar, Object, MST);
501  } else {
502  auto &Object = YMF.StackObjects[StackObjectsIdx[DebugVar.Slot]];
503  printStackObjectDbgInfo(DebugVar, Object, MST);
504  }
505  }
506 }
507 
509  const MachineFunction &MF,
510  ModuleSlotTracker &MST) {
511  const auto *TRI = MF.getSubtarget().getRegisterInfo();
512  for (auto CSInfo : MF.getCallSitesInfo()) {
513  yaml::CallSiteInfo YmlCS;
515 
516  // Prepare instruction position.
517  MachineBasicBlock::const_instr_iterator CallI = CSInfo.first->getIterator();
518  CallLocation.BlockNum = CallI->getParent()->getNumber();
519  // Get call instruction offset from the beginning of block.
520  CallLocation.Offset =
521  std::distance(CallI->getParent()->instr_begin(), CallI);
522  YmlCS.CallLocation = CallLocation;
523  // Construct call arguments and theirs forwarding register info.
524  for (auto ArgReg : CSInfo.second) {
526  YmlArgReg.ArgNo = ArgReg.ArgNo;
527  printRegMIR(ArgReg.Reg, YmlArgReg.Reg, TRI);
528  YmlCS.ArgForwardingRegs.emplace_back(YmlArgReg);
529  }
530  YMF.CallSitesInfo.push_back(YmlCS);
531  }
532 
533  // Sort call info by position of call instructions.
534  llvm::sort(YMF.CallSitesInfo.begin(), YMF.CallSitesInfo.end(),
536  if (A.CallLocation.BlockNum == B.CallLocation.BlockNum)
537  return A.CallLocation.Offset < B.CallLocation.Offset;
538  return A.CallLocation.BlockNum < B.CallLocation.BlockNum;
539  });
540 }
541 
543  const MachineFunction &MF,
546  MST.collectMachineMDNodes(MDList);
547  for (auto &MD : MDList) {
548  std::string NS;
549  raw_string_ostream StrOS(NS);
550  MD.second->print(StrOS, MST, MF.getFunction().getParent());
551  YMF.MachineMetadataNodes.push_back(StrOS.str());
552  }
553 }
554 
557  unsigned ID = 0;
558  for (const MachineConstantPoolEntry &Constant : ConstantPool.getConstants()) {
559  std::string Str;
560  raw_string_ostream StrOS(Str);
561  if (Constant.isMachineConstantPoolEntry()) {
562  Constant.Val.MachineCPVal->print(StrOS);
563  } else {
564  Constant.Val.ConstVal->printAsOperand(StrOS);
565  }
566 
567  yaml::MachineConstantPoolValue YamlConstant;
568  YamlConstant.ID = ID++;
569  YamlConstant.Value = StrOS.str();
570  YamlConstant.Alignment = Constant.getAlign();
571  YamlConstant.IsTargetSpecific = Constant.isMachineConstantPoolEntry();
572 
573  MF.Constants.push_back(YamlConstant);
574  }
575 }
576 
578  yaml::MachineJumpTable &YamlJTI,
579  const MachineJumpTableInfo &JTI) {
580  YamlJTI.Kind = JTI.getEntryKind();
581  unsigned ID = 0;
582  for (const auto &Table : JTI.getJumpTables()) {
583  std::string Str;
585  Entry.ID = ID++;
586  for (const auto *MBB : Table.MBBs) {
587  raw_string_ostream StrOS(Str);
588  StrOS << printMBBReference(*MBB);
589  Entry.Blocks.push_back(StrOS.str());
590  Str.clear();
591  }
592  YamlJTI.Entries.push_back(Entry);
593  }
594 }
595 
596 void MIRPrinter::initRegisterMaskIds(const MachineFunction &MF) {
597  const auto *TRI = MF.getSubtarget().getRegisterInfo();
598  unsigned I = 0;
599  for (const uint32_t *Mask : TRI->getRegMasks())
600  RegisterMaskIds.insert(std::make_pair(Mask, I++));
601 }
602 
605  bool &IsFallthrough) {
607 
608  for (const MachineInstr &MI : MBB) {
609  if (MI.isPHI())
610  continue;
611  for (const MachineOperand &MO : MI.operands()) {
612  if (!MO.isMBB())
613  continue;
614  MachineBasicBlock *Succ = MO.getMBB();
615  auto RP = Seen.insert(Succ);
616  if (RP.second)
617  Result.push_back(Succ);
618  }
619  }
621  IsFallthrough = I == MBB.end() || !I->isBarrier();
622 }
623 
624 bool
625 MIPrinter::canPredictBranchProbabilities(const MachineBasicBlock &MBB) const {
626  if (MBB.succ_size() <= 1)
627  return true;
629  return true;
630 
631  SmallVector<BranchProbability,8> Normalized(MBB.Probs.begin(),
632  MBB.Probs.end());
634  Normalized.end());
635  SmallVector<BranchProbability,8> Equal(Normalized.size());
637 
638  return std::equal(Normalized.begin(), Normalized.end(), Equal.begin());
639 }
640 
641 bool MIPrinter::canPredictSuccessors(const MachineBasicBlock &MBB) const {
643  bool GuessedFallthrough;
644  guessSuccessors(MBB, GuessedSuccs, GuessedFallthrough);
645  if (GuessedFallthrough) {
646  const MachineFunction &MF = *MBB.getParent();
647  MachineFunction::const_iterator NextI = std::next(MBB.getIterator());
648  if (NextI != MF.end()) {
649  MachineBasicBlock *Next = const_cast<MachineBasicBlock*>(&*NextI);
650  if (!is_contained(GuessedSuccs, Next))
651  GuessedSuccs.push_back(Next);
652  }
653  }
654  if (GuessedSuccs.size() != MBB.succ_size())
655  return false;
656  return std::equal(MBB.succ_begin(), MBB.succ_end(), GuessedSuccs.begin());
657 }
658 
660  assert(MBB.getNumber() >= 0 && "Invalid MBB number");
661  MBB.printName(OS,
664  &MST);
665  OS << ":\n";
666 
667  bool HasLineAttributes = false;
668  // Print the successors
669  bool canPredictProbs = canPredictBranchProbabilities(MBB);
670  // Even if the list of successors is empty, if we cannot guess it,
671  // we need to print it to tell the parser that the list is empty.
672  // This is needed, because MI model unreachable as empty blocks
673  // with an empty successor list. If the parser would see that
674  // without the successor list, it would guess the code would
675  // fallthrough.
676  if ((!MBB.succ_empty() && !SimplifyMIR) || !canPredictProbs ||
677  !canPredictSuccessors(MBB)) {
678  OS.indent(2) << "successors: ";
679  for (auto I = MBB.succ_begin(), E = MBB.succ_end(); I != E; ++I) {
680  if (I != MBB.succ_begin())
681  OS << ", ";
682  OS << printMBBReference(**I);
683  if (!SimplifyMIR || !canPredictProbs)
684  OS << '('
685  << format("0x%08" PRIx32, MBB.getSuccProbability(I).getNumerator())
686  << ')';
687  }
688  OS << "\n";
689  HasLineAttributes = true;
690  }
691 
692  // Print the live in registers.
694  if (!MBB.livein_empty()) {
696  OS.indent(2) << "liveins: ";
697  bool First = true;
698  for (const auto &LI : MBB.liveins_dbg()) {
699  if (!First)
700  OS << ", ";
701  First = false;
702  OS << printReg(LI.PhysReg, &TRI);
703  if (!LI.LaneMask.all())
704  OS << ":0x" << PrintLaneMask(LI.LaneMask);
705  }
706  OS << "\n";
707  HasLineAttributes = true;
708  }
709 
710  if (HasLineAttributes)
711  OS << "\n";
712  bool IsInBundle = false;
713  for (auto I = MBB.instr_begin(), E = MBB.instr_end(); I != E; ++I) {
714  const MachineInstr &MI = *I;
715  if (IsInBundle && !MI.isInsideBundle()) {
716  OS.indent(2) << "}\n";
717  IsInBundle = false;
718  }
719  OS.indent(IsInBundle ? 4 : 2);
720  print(MI);
721  if (!IsInBundle && MI.getFlag(MachineInstr::BundledSucc)) {
722  OS << " {";
723  IsInBundle = true;
724  }
725  OS << "\n";
726  }
727  if (IsInBundle)
728  OS.indent(2) << "}\n";
729 }
730 
732  const auto *MF = MI.getMF();
733  const auto &MRI = MF->getRegInfo();
734  const auto &SubTarget = MF->getSubtarget();
735  const auto *TRI = SubTarget.getRegisterInfo();
736  assert(TRI && "Expected target register info");
737  const auto *TII = SubTarget.getInstrInfo();
738  assert(TII && "Expected target instruction info");
739  if (MI.isCFIInstruction())
740  assert(MI.getNumOperands() == 1 && "Expected 1 operand in CFI instruction");
741 
742  SmallBitVector PrintedTypes(8);
743  bool ShouldPrintRegisterTies = MI.hasComplexRegisterTies();
744  unsigned I = 0, E = MI.getNumOperands();
745  for (; I < E && MI.getOperand(I).isReg() && MI.getOperand(I).isDef() &&
746  !MI.getOperand(I).isImplicit();
747  ++I) {
748  if (I)
749  OS << ", ";
750  print(MI, I, TRI, TII, ShouldPrintRegisterTies,
751  MI.getTypeToPrint(I, PrintedTypes, MRI),
752  /*PrintDef=*/false);
753  }
754 
755  if (I)
756  OS << " = ";
757  if (MI.getFlag(MachineInstr::FrameSetup))
758  OS << "frame-setup ";
759  if (MI.getFlag(MachineInstr::FrameDestroy))
760  OS << "frame-destroy ";
761  if (MI.getFlag(MachineInstr::FmNoNans))
762  OS << "nnan ";
763  if (MI.getFlag(MachineInstr::FmNoInfs))
764  OS << "ninf ";
765  if (MI.getFlag(MachineInstr::FmNsz))
766  OS << "nsz ";
767  if (MI.getFlag(MachineInstr::FmArcp))
768  OS << "arcp ";
769  if (MI.getFlag(MachineInstr::FmContract))
770  OS << "contract ";
771  if (MI.getFlag(MachineInstr::FmAfn))
772  OS << "afn ";
773  if (MI.getFlag(MachineInstr::FmReassoc))
774  OS << "reassoc ";
775  if (MI.getFlag(MachineInstr::NoUWrap))
776  OS << "nuw ";
777  if (MI.getFlag(MachineInstr::NoSWrap))
778  OS << "nsw ";
779  if (MI.getFlag(MachineInstr::IsExact))
780  OS << "exact ";
781  if (MI.getFlag(MachineInstr::NoFPExcept))
782  OS << "nofpexcept ";
783  if (MI.getFlag(MachineInstr::NoMerge))
784  OS << "nomerge ";
785 
786  OS << TII->getName(MI.getOpcode());
787  if (I < E)
788  OS << ' ';
789 
790  bool NeedComma = false;
791  for (; I < E; ++I) {
792  if (NeedComma)
793  OS << ", ";
794  print(MI, I, TRI, TII, ShouldPrintRegisterTies,
795  MI.getTypeToPrint(I, PrintedTypes, MRI));
796  NeedComma = true;
797  }
798 
799  // Print any optional symbols attached to this instruction as-if they were
800  // operands.
801  if (MCSymbol *PreInstrSymbol = MI.getPreInstrSymbol()) {
802  if (NeedComma)
803  OS << ',';
804  OS << " pre-instr-symbol ";
805  MachineOperand::printSymbol(OS, *PreInstrSymbol);
806  NeedComma = true;
807  }
808  if (MCSymbol *PostInstrSymbol = MI.getPostInstrSymbol()) {
809  if (NeedComma)
810  OS << ',';
811  OS << " post-instr-symbol ";
812  MachineOperand::printSymbol(OS, *PostInstrSymbol);
813  NeedComma = true;
814  }
815  if (MDNode *HeapAllocMarker = MI.getHeapAllocMarker()) {
816  if (NeedComma)
817  OS << ',';
818  OS << " heap-alloc-marker ";
819  HeapAllocMarker->printAsOperand(OS, MST);
820  NeedComma = true;
821  }
822  if (MDNode *PCSections = MI.getPCSections()) {
823  if (NeedComma)
824  OS << ',';
825  OS << " pcsections ";
826  PCSections->printAsOperand(OS, MST);
827  NeedComma = true;
828  }
829  if (uint32_t CFIType = MI.getCFIType()) {
830  if (NeedComma)
831  OS << ',';
832  OS << " cfi-type " << CFIType;
833  NeedComma = true;
834  }
835 
836  if (auto Num = MI.peekDebugInstrNum()) {
837  if (NeedComma)
838  OS << ',';
839  OS << " debug-instr-number " << Num;
840  NeedComma = true;
841  }
842 
843  if (PrintLocations) {
844  if (const DebugLoc &DL = MI.getDebugLoc()) {
845  if (NeedComma)
846  OS << ',';
847  OS << " debug-location ";
848  DL->printAsOperand(OS, MST);
849  }
850  }
851 
852  if (!MI.memoperands_empty()) {
853  OS << " :: ";
854  const LLVMContext &Context = MF->getFunction().getContext();
855  const MachineFrameInfo &MFI = MF->getFrameInfo();
856  bool NeedComma = false;
857  for (const auto *Op : MI.memoperands()) {
858  if (NeedComma)
859  OS << ", ";
860  Op->print(OS, MST, SSNs, Context, &MFI, TII);
861  NeedComma = true;
862  }
863  }
864 }
865 
867  auto ObjectInfo = StackObjectOperandMapping.find(FrameIndex);
868  assert(ObjectInfo != StackObjectOperandMapping.end() &&
869  "Invalid frame index");
870  const FrameIndexOperand &Operand = ObjectInfo->second;
871  MachineOperand::printStackObjectReference(OS, Operand.ID, Operand.IsFixed,
872  Operand.Name);
873 }
874 
875 static std::string formatOperandComment(std::string Comment) {
876  if (Comment.empty())
877  return Comment;
878  return std::string(" /* " + Comment + " */");
879 }
880 
881 void MIPrinter::print(const MachineInstr &MI, unsigned OpIdx,
882  const TargetRegisterInfo *TRI,
883  const TargetInstrInfo *TII,
884  bool ShouldPrintRegisterTies, LLT TypeToPrint,
885  bool PrintDef) {
886  const MachineOperand &Op = MI.getOperand(OpIdx);
887  std::string MOComment = TII->createMIROperandComment(MI, Op, OpIdx, TRI);
888 
889  switch (Op.getType()) {
891  if (MI.isOperandSubregIdx(OpIdx)) {
893  MachineOperand::printSubRegIdx(OS, Op.getImm(), TRI);
894  break;
895  }
896  [[fallthrough]];
914  unsigned TiedOperandIdx = 0;
915  if (ShouldPrintRegisterTies && Op.isReg() && Op.isTied() && !Op.isDef())
916  TiedOperandIdx = Op.getParent()->findTiedOperandIdx(OpIdx);
917  const TargetIntrinsicInfo *TII = MI.getMF()->getTarget().getIntrinsicInfo();
918  Op.print(OS, MST, TypeToPrint, OpIdx, PrintDef, /*IsStandalone=*/false,
919  ShouldPrintRegisterTies, TiedOperandIdx, TRI, TII);
920  OS << formatOperandComment(MOComment);
921  break;
922  }
924  printStackObjectReference(Op.getIndex());
925  break;
927  auto RegMaskInfo = RegisterMaskIds.find(Op.getRegMask());
928  if (RegMaskInfo != RegisterMaskIds.end())
929  OS << StringRef(TRI->getRegMaskNames()[RegMaskInfo->second]).lower();
930  else
931  printCustomRegMask(Op.getRegMask(), OS, TRI);
932  break;
933  }
934  }
935 }
936 
938  ModuleSlotTracker &MST) {
939  if (isa<GlobalValue>(V)) {
940  V.printAsOperand(OS, /*PrintType=*/false, MST);
941  return;
942  }
943  if (isa<Constant>(V)) {
944  // Machine memory operands can load/store to/from constant value pointers.
945  OS << '`';
946  V.printAsOperand(OS, /*PrintType=*/true, MST);
947  OS << '`';
948  return;
949  }
950  OS << "%ir.";
951  if (V.hasName()) {
953  return;
954  }
955  int Slot = MST.getCurrentFunction() ? MST.getLocalSlot(&V) : -1;
957 }
958 
959 void llvm::printMIR(raw_ostream &OS, const Module &M) {
960  yaml::Output Out(OS);
961  Out << const_cast<Module &>(M);
962 }
963 
965  MIRPrinter Printer(OS);
966  Printer.print(MF);
967 }
llvm::MachineFunction::hasWinCFI
bool hasWinCFI() const
Definition: MachineFunction.h:738
i
i
Definition: README.txt:29
llvm::MIRFormatter::printIRValue
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...
Definition: MIRPrinter.cpp:937
llvm::MachineFrameInfo::isMaxCallFrameSizeComputed
bool isMaxCallFrameSizeComputed() const
Definition: MachineFrameInfo.h:653
llvm::yaml::MachineFunction::RegBankSelected
bool RegBankSelected
Definition: MIRYamlMapping.h:694
llvm::MachineBasicBlock::succ_size
unsigned succ_size() const
Definition: MachineBasicBlock.h:381
llvm::MachineOperand::MO_BlockAddress
@ MO_BlockAddress
Address of a basic block.
Definition: MachineOperand.h:62
llvm::yaml::MachineFrameInfo::OffsetAdjustment
int OffsetAdjustment
Definition: MIRYamlMapping.h:603
llvm::MachineFunctionProperties::hasProperty
bool hasProperty(Property P) const
Definition: MachineFunction.h:192
llvm::yaml::MachineConstantPoolValue::ID
UnsignedValue ID
Definition: MIRYamlMapping.h:522
llvm::yaml::CallSiteInfo::ArgForwardingRegs
std::vector< ArgRegPair > ArgForwardingRegs
Definition: MIRYamlMapping.h:454
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:108
MachineInstr.h
llvm::MachineOperand::MO_Immediate
@ MO_Immediate
Immediate operand.
Definition: MachineOperand.h:52
llvm::ModuleSlotTracker::getLocalSlot
int getLocalSlot(const Value *V)
Return the slot number of the specified local value.
Definition: AsmWriter.cpp:874
llvm::object::Equal
@ Equal
Definition: COFFModuleDefinition.cpp:36
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::yaml::MachineFunction::HasEHFunclets
bool HasEHFunclets
Definition: MIRYamlMapping.h:705
llvm::yaml::FixedMachineStackObject::Type
ObjectType Type
Definition: MIRYamlMapping.h:311
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::MachineFrameInfo::hasVAStart
bool hasVAStart() const
Returns true if the function calls the llvm.va_start intrinsic.
Definition: MachineFrameInfo.h:622
TargetFrameLowering.h
llvm::MachineFunction::getVariableDbgInfo
VariableDbgInfoMapTy & getVariableDbgInfo()
Definition: MachineFunction.h:1230
llvm::MachineFrameInfo::getNumFixedObjects
unsigned getNumFixedObjects() const
Return the number of fixed objects.
Definition: MachineFrameInfo.h:412
llvm::MachineRegisterInfo::getVRegName
StringRef getVRegName(Register Reg) const
Definition: MachineRegisterInfo.h:436
llvm::yaml::MachineStackObject::Offset
int64_t Offset
Definition: MIRYamlMapping.h:246
DebugInfoMetadata.h
llvm::MachineOperand::MO_ShuffleMask
@ MO_ShuffleMask
Other IR Constant for ISel (shuffle masks)
Definition: MachineOperand.h:70
llvm::MachineRegisterInfo
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Definition: MachineRegisterInfo.h:50
T
llvm::MachineOperand::MO_RegisterLiveOut
@ MO_RegisterLiveOut
Mask of live-out registers.
Definition: MachineOperand.h:64
llvm::yaml::MachineJumpTable::Entry
Definition: MIRYamlMapping.h:544
llvm::yaml::MachineFrameInfo::StackSize
uint64_t StackSize
Definition: MIRYamlMapping.h:602
StringRef.h
llvm::BranchProbability::getNumerator
uint32_t getNumerator() const
Definition: BranchProbability.h:65
llvm::yaml::MachineFunction::JumpTableInfo
MachineJumpTable JumpTableInfo
Definition: MIRYamlMapping.h:721
llvm::raw_string_ostream
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:628
llvm::MachineOperand::printStackObjectReference
static void printStackObjectReference(raw_ostream &OS, unsigned FrameIndex, bool IsFixed, StringRef Name)
Print a stack object reference.
Definition: MachineOperand.cpp:596
llvm::MachineOperand::printIRSlotNumber
static void printIRSlotNumber(raw_ostream &OS, int Slot)
Print an IRSlotNumber.
Definition: MachineOperand.cpp:619
llvm::TargetRegisterInfo::getRegMaskNames
virtual ArrayRef< const char * > getRegMaskNames() const =0
llvm::yaml::MachineFrameInfo::RestorePoint
StringValue RestorePoint
Definition: MIRYamlMapping.h:617
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1181
llvm::printLLVMNameWithoutPrefix
void printLLVMNameWithoutPrefix(raw_ostream &OS, StringRef Name)
Print out a name of an LLVM value without any prefixes.
Definition: AsmWriter.cpp:355
llvm::yaml::VirtualRegisterDefinition::PreferredRegister
StringValue PreferredRegister
Definition: MIRYamlMapping.h:191
llvm::MachineFunction::end
iterator end()
Definition: MachineFunction.h:855
llvm::printMBBReference
Printable printMBBReference(const MachineBasicBlock &MBB)
Prints a machine basic block reference.
Definition: MachineBasicBlock.cpp:116
llvm::MachineFrameInfo::getCVBytesOfCalleeSavedRegisters
unsigned getCVBytesOfCalleeSavedRegisters() const
Returns how many bytes of callee-saved registers the target pushed in the prologue.
Definition: MachineFrameInfo.h:660
llvm::yaml::MachineFunction::StackObjects
std::vector< MachineStackObject > StackObjects
Definition: MIRYamlMapping.h:716
llvm::ModuleSlotTracker::getCurrentFunction
const Function * getCurrentFunction() const
Definition: ModuleSlotTracker.h:81
llvm::Value::hasName
bool hasName() const
Definition: Value.h:261
ErrorHandling.h
llvm::MachineFunction::exposesReturnsTwice
bool exposesReturnsTwice() const
exposesReturnsTwice - Returns true if the function calls setjmp or any other similar functions with a...
Definition: MachineFunction.h:718
llvm::MCRegisterInfo::getNumRegs
unsigned getNumRegs() const
Return the number of registers this target has (useful for sizing arrays holding per register informa...
Definition: MCRegisterInfo.h:491
llvm::yaml::MachineFunction::TracksRegLiveness
bool TracksRegLiveness
Definition: MIRYamlMapping.h:698
llvm::X86Disassembler::Reg
Reg
All possible values of the reg field in the ModR/M byte.
Definition: X86DisassemblerDecoder.h:462
llvm::MachineRegisterInfo::getTargetRegisterInfo
const TargetRegisterInfo * getTargetRegisterInfo() const
Definition: MachineRegisterInfo.h:151
llvm::yaml::FixedMachineStackObject::IsImmutable
bool IsImmutable
Definition: MIRYamlMapping.h:316
llvm::yaml::FixedMachineStackObject::DefaultType
@ DefaultType
Definition: MIRYamlMapping.h:309
llvm::yaml::MachineStackObject
Serializable representation of stack object from the MachineFrameInfo class.
Definition: MIRYamlMapping.h:240
llvm::MachineFrameInfo::getOffsetAdjustment
int getOffsetAdjustment() const
Return the correction for frame offsets.
Definition: MachineFrameInfo.h:586
llvm::MIRPrinter::convert
void convert(yaml::MachineFunction &MF, const MachineRegisterInfo &RegInfo, const TargetRegisterInfo *TRI)
Definition: MIRPrinter.cpp:302
MachineBasicBlock.h
llvm::ConstantPool
Definition: ConstantPools.h:43
llvm::yaml::MachineFunctionLiveIn::Register
StringValue Register
Definition: MIRYamlMapping.h:213
llvm::TargetSubtargetInfo::getRegisterInfo
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
Definition: TargetSubtargetInfo.h:125
MachineModuleSlotTracker.h
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:139
llvm::MIRPrinter::convertStackObjects
void convertStackObjects(yaml::MachineFunction &YMF, const MachineFunction &MF, ModuleSlotTracker &MST)
Definition: MIRPrinter.cpp:374
llvm::TargetRegisterInfo
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Definition: TargetRegisterInfo.h:237
llvm::MachineFrameInfo::hasFunctionContextIndex
bool hasFunctionContextIndex() const
Definition: MachineFrameInfo.h:365
llvm::Function::getContext
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function.
Definition: Function.cpp:320
MachineJumpTableInfo.h
DenseMap.h
Module.h
llvm::yaml::CallSiteInfo::MachineInstrLoc::Offset
unsigned Offset
Definition: MIRYamlMapping.h:446
llvm::yaml::MachineFunction::Alignment
MaybeAlign Alignment
Definition: MIRYamlMapping.h:690
TargetInstrInfo.h
llvm::MachineInstr::FmAfn
@ FmAfn
Definition: MachineInstr.h:100
llvm::MachineOperand::MO_CFIIndex
@ MO_CFIIndex
MCCFIInstruction index.
Definition: MachineOperand.h:67
llvm::MachineFunction::callsUnwindInit
bool callsUnwindInit() const
Definition: MachineFunction.h:1090
llvm::MachineRegisterInfo::getNumVirtRegs
unsigned getNumVirtRegs() const
getNumVirtRegs - Return the number of virtual registers created.
Definition: MachineRegisterInfo.h:770
llvm::SmallPtrSet
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
Definition: SmallPtrSet.h:450
llvm::yaml::FixedMachineStackObject::SpillSlot
@ SpillSlot
Definition: MIRYamlMapping.h:309
printRegMIR
static void printRegMIR(unsigned Reg, yaml::StringValue &Dest, const TargetRegisterInfo *TRI)
Definition: MIRPrinter.cpp:183
llvm::Register::index2VirtReg
static Register index2VirtReg(unsigned Index)
Convert a 0-based index to a virtual register number.
Definition: Register.h:84
llvm::ModuleSlotTracker::incorporateFunction
void incorporateFunction(const Function &F)
Incorporate the given function.
Definition: AsmWriter.cpp:860
STLExtras.h
llvm::MachineFrameInfo::getObjectIndexEnd
int getObjectIndexEnd() const
Return one past the maximum frame object index.
Definition: MachineFrameInfo.h:409
llvm::yaml::CallSiteInfo
Serializable representation of CallSiteInfo.
Definition: MIRYamlMapping.h:431
Format.h
llvm::ModuleSlotTracker
Manage lifetime of a slot tracker for printing IR.
Definition: ModuleSlotTracker.h:44
TRI
unsigned const TargetRegisterInfo * TRI
Definition: MachineSink.cpp:1628
llvm::yaml::MachineFrameInfo::CVBytesOfCalleeSavedRegisters
unsigned CVBytesOfCalleeSavedRegisters
Definition: MIRYamlMapping.h:610
llvm::yaml::MachineFunction::Name
StringRef Name
Definition: MIRYamlMapping.h:689
llvm::MachineFrameInfo::getMaxCallFrameSize
unsigned getMaxCallFrameSize() const
Return the maximum size of a call frame that must be allocated for an outgoing function call.
Definition: MachineFrameInfo.h:646
llvm::yaml::VirtualRegisterDefinition
Definition: MIRYamlMapping.h:188
llvm::yaml::MachineJumpTable
Definition: MIRYamlMapping.h:543
llvm::yaml::MachineStackObject::StackID
TargetStackID::Value StackID
Definition: MIRYamlMapping.h:249
llvm::yaml::FlowStringValue
Definition: MIRYamlMapping.h:63
PrintLocations
static cl::opt< bool > PrintLocations("mir-debug-loc", cl::Hidden, cl::init(true), cl::desc("Print MIR debug-locations"))
llvm::MachineOperand::MO_Register
@ MO_Register
Register operand.
Definition: MachineOperand.h:51
llvm::yaml::MachineStackObject::VariableSized
@ VariableSized
Definition: MIRYamlMapping.h:241
MachineRegisterInfo.h
llvm::MachineInstr::FrameDestroy
@ FrameDestroy
Definition: MachineInstr.h:86
llvm::lltok::equal
@ equal
Definition: LLToken.h:25
llvm::MachineOperand::printSymbol
static void printSymbol(raw_ostream &OS, MCSymbol &Sym)
Print a MCSymbol as an operand.
Definition: MachineOperand.cpp:592
llvm::TargetIntrinsicInfo
TargetIntrinsicInfo - Interface to description of machine instruction set.
Definition: TargetIntrinsicInfo.h:29
llvm::MachineRegisterInfo::tracksLiveness
bool tracksLiveness() const
tracksLiveness - Returns true when tracking register liveness accurately.
Definition: MachineRegisterInfo.h:195
llvm::MachineJumpTableInfo::getEntryKind
JTEntryKind getEntryKind() const
Definition: MachineJumpTableInfo.h:84
llvm::yaml::MachineStackObject::Alignment
MaybeAlign Alignment
Definition: MIRYamlMapping.h:248
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::MachineBasicBlock::printName
void printName(raw_ostream &os, unsigned printNameFlags=PrintNameIr, ModuleSlotTracker *moduleSlotTracker=nullptr) const
Print the basic block's name as:
Definition: MachineBasicBlock.cpp:474
SimplifyMIR
static cl::opt< bool > SimplifyMIR("simplify-mir", cl::Hidden, cl::desc("Leave out unnecessary information when printing MIR"))
llvm::SmallBitVector
This is a 'bitvector' (really, a variable-sized bit array), optimized for the case when the array is ...
Definition: SmallBitVector.h:35
llvm::MachineOperand::printSubRegIdx
static void printSubRegIdx(raw_ostream &OS, uint64_t Index, const TargetRegisterInfo *TRI)
Print a subreg index operand.
Definition: MachineOperand.cpp:531
llvm::BitmaskEnumDetail::Mask
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
Definition: BitmaskEnum.h:80
CommandLine.h
Printer
print alias Alias Set Printer
Definition: AliasSetTracker.cpp:734
llvm::yaml::MachineFrameInfo::AdjustsStack
bool AdjustsStack
Definition: MIRYamlMapping.h:605
llvm::MIRPrinter
This class prints out the machine functions using the MIR serialization format.
Definition: MIRPrinter.cpp:100
llvm::MachineFunction::getRegInfo
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Definition: MachineFunction.h:666
llvm::yaml::CallSiteInfo::ArgRegPair::ArgNo
uint16_t ArgNo
Definition: MIRYamlMapping.h:436
MIRYamlMapping.h
llvm::TargetInstrInfo
TargetInstrInfo - Interface to description of machine instruction set.
Definition: TargetInstrInfo.h:98
llvm::MachineFunctionProperties::Property::Selected
@ Selected
TargetMachine.h
llvm::yaml::FixedMachineStackObject::Alignment
MaybeAlign Alignment
Definition: MIRYamlMapping.h:314
llvm::yaml::MachineStackObject::DefaultType
@ DefaultType
Definition: MIRYamlMapping.h:241
llvm::MIRPrinter::print
void print(const MachineFunction &MF)
Definition: MIRPrinter.cpp:189
llvm::MachineOperand::MO_GlobalAddress
@ MO_GlobalAddress
Address of a global value.
Definition: MachineOperand.h:61
llvm::AArch64::RP
@ RP
Definition: AArch64ISelLowering.h:477
llvm::MachineFrameInfo::isReturnAddressTaken
bool isReturnAddressTaken() const
This method may be called any time after instruction selection is complete to determine if there is a...
Definition: MachineFrameInfo.h:376
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::MachineBasicBlock::succ_end
succ_iterator succ_end()
Definition: MachineBasicBlock.h:371
llvm::MIPrinter::MIPrinter
MIPrinter(raw_ostream &OS, ModuleSlotTracker &MST, const DenseMap< const uint32_t *, unsigned > &RegisterMaskIds, const DenseMap< int, FrameIndexOperand > &StackObjectOperandMapping)
Definition: MIRPrinter.cpp:147
llvm::MachineRegisterInfo::isUpdatedCSRsInitialized
bool isUpdatedCSRsInitialized() const
Returns true if the updated CSR list was initialized and false otherwise.
Definition: MachineRegisterInfo.h:228
llvm::yaml::CallSiteInfo::CallLocation
MachineInstrLoc CallLocation
Definition: MIRYamlMapping.h:453
llvm::yaml::MachineFunction::CallsUnwindInit
bool CallsUnwindInit
Definition: MIRYamlMapping.h:702
llvm::yaml::MachineFunction::MachineFuncInfo
std::unique_ptr< MachineFunctionInfo > MachineFuncInfo
Constant pool.
Definition: MIRYamlMapping.h:718
llvm::MachineOperand::MO_FrameIndex
@ MO_FrameIndex
Abstract Stack Frame Index.
Definition: MachineOperand.h:56
llvm::guessSuccessors
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...
Definition: MIRPrinter.cpp:603
llvm::yaml::BlockScalarTraits< Module >::input
static StringRef input(StringRef Str, void *Ctxt, Module &Mod)
Definition: MIRPrinter.cpp:174
llvm::MachineFunction::getProperties
const MachineFunctionProperties & getProperties() const
Get the function properties.
Definition: MachineFunction.h:747
llvm::MachineInstr::FmNoInfs
@ FmNoInfs
Definition: MachineInstr.h:92
TII
const HexagonInstrInfo * TII
Definition: HexagonCopyToCombine.cpp:125
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
First
into llvm powi allowing the code generator to produce balanced multiplication trees First
Definition: README.txt:54
llvm::MachineOperand
MachineOperand class - Representation of each machine instruction operand.
Definition: MachineOperand.h:48
llvm::MIPrinter::printStackObjectReference
void printStackObjectReference(int FrameIndex)
Definition: MIRPrinter.cpp:866
llvm::MachineInstr::FrameSetup
@ FrameSetup
Definition: MachineInstr.h:84
llvm::MachineFunction::hasEHCatchret
bool hasEHCatchret() const
Definition: MachineFunction.h:1093
llvm::yaml::FixedMachineStackObject::StackID
TargetStackID::Value StackID
Definition: MIRYamlMapping.h:315
IRPrintingPasses.h
llvm::MachineFrameInfo::getRestorePoint
MachineBasicBlock * getRestorePoint() const
Definition: MachineFrameInfo.h:798
llvm::MachineFrameInfo::getStackID
uint8_t getStackID(int ObjectIdx) const
Definition: MachineFrameInfo.h:723
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
llvm::PrintLaneMask
Printable PrintLaneMask(LaneBitmask LaneMask)
Create Printable object to print LaneBitmasks on a raw_ostream.
Definition: LaneBitmask.h:94
llvm::MachineFrameInfo::isAliasedObjectIndex
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...
Definition: MachineFrameInfo.h:686
llvm::yaml::MachineFunction::CalleeSavedRegisters
Optional< std::vector< FlowStringValue > > CalleeSavedRegisters
Definition: MIRYamlMapping.h:711
llvm::yaml::MachineFrameInfo::HasVAStart
bool HasVAStart
Definition: MIRYamlMapping.h:612
llvm::raw_ostream::flush
void flush()
Definition: raw_ostream.h:185
llvm::yaml::CallSiteInfo::ArgRegPair::Reg
StringValue Reg
Definition: MIRYamlMapping.h:435
printStackObjectDbgInfo
static void printStackObjectDbgInfo(const MachineFunction::VariableDbgInfo &DebugVar, T &Object, ModuleSlotTracker &MST)
Definition: MIRPrinter.cpp:288
llvm::MachineFrameInfo::getStackSize
uint64_t getStackSize() const
Return the number of bytes that must be allocated to hold all of the fixed size frame objects.
Definition: MachineFrameInfo.h:577
DebugLoc.h
llvm::MachineFrameInfo::hasMustTailInVarArgFunc
bool hasMustTailInVarArgFunc() const
Returns true if the function is variadic and contains a musttail call.
Definition: MachineFrameInfo.h:626
SmallPtrSet.h
llvm::yaml::MachineFunction::FrameInfo
MachineFrameInfo FrameInfo
Definition: MIRYamlMapping.h:714
llvm::MachineFrameInfo::getObjectOffset
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
Definition: MachineFrameInfo.h:518
llvm::yaml::MachineFrameInfo::HasCalls
bool HasCalls
Definition: MIRYamlMapping.h:606
llvm::yaml::MachineConstantPoolValue::Value
StringValue Value
Definition: MIRYamlMapping.h:523
llvm::MachineInstr::NoSWrap
@ NoSWrap
Definition: MachineInstr.h:106
llvm::printMIR
void printMIR(raw_ostream &OS, const Module &M)
Print LLVM IR using the MIR serialization format to the given output stream.
Definition: MIRPrinter.cpp:959
llvm::MachineFrameInfo::getObjectIndexBegin
int getObjectIndexBegin() const
Return the minimum frame object index.
Definition: MachineFrameInfo.h:406
llvm::MachineInstr::FmNsz
@ FmNsz
Definition: MachineInstr.h:94
llvm::MachineInstr::NoFPExcept
@ NoFPExcept
Definition: MachineInstr.h:110
llvm::CallingConv::ID
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
BranchProbability.h
llvm::MachineBasicBlock
Definition: MachineBasicBlock.h:94
llvm::MachineFrameInfo::isDeadObjectIndex
bool isDeadObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a dead object.
Definition: MachineFrameInfo.h:737
LowLevelTypeImpl.h
llvm::MachineModuleSlotTracker
Definition: MachineModuleSlotTracker.h:22
llvm::MachineFunction::VariableDbgInfo::Expr
const DIExpression * Expr
Definition: MachineFunction.h:406
llvm::OutputFileType::Object
@ Object
llvm::MachineFunctionProperties::Property::FailsVerification
@ FailsVerification
llvm::yaml::FixedMachineStackObject
Serializable representation of the fixed stack object from the MachineFrameInfo class.
Definition: MIRYamlMapping.h:308
llvm::sort
void sort(IteratorTy Start, IteratorTy End)
Definition: STLExtras.h:1538
llvm::yaml::MachineFrameInfo::StackProtector
StringValue StackProtector
Definition: MIRYamlMapping.h:607
llvm::MachineFunction::getSubtarget
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Definition: MachineFunction.h:656
llvm::MachineBasicBlock::getSuccProbability
BranchProbability getSuccProbability(const_succ_iterator Succ) const
Return probability of the edge from this block to MBB.
Definition: MachineBasicBlock.cpp:1443
llvm::MachineFrameInfo::getLocalFrameObjectMap
std::pair< int, int64_t > getLocalFrameObjectMap(int i) const
Get the local offset mapping for a for an object.
Definition: MachineFrameInfo.h:424
llvm::cl::opt< bool >
llvm::MachineBasicBlock::hasSuccessorProbabilities
bool hasSuccessorProbabilities() const
Return true if any of the successors have probabilities attached to them.
Definition: MachineBasicBlock.h:752
llvm::MachineOperand::MO_Metadata
@ MO_Metadata
Metadata reference (for debug info)
Definition: MachineOperand.h:65
llvm::MachineJumpTableInfo::getJumpTables
const std::vector< MachineJumpTableEntry > & getJumpTables() const
Definition: MachineJumpTableInfo.h:99
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
llvm::MachineBasicBlock::printAsOperand
void printAsOperand(raw_ostream &OS, bool PrintType=true) const
Definition: MachineBasicBlock.cpp:566
llvm::yaml::FixedMachineStackObject::ID
UnsignedValue ID
Definition: MIRYamlMapping.h:310
llvm::yaml::MachineFunction::Selected
bool Selected
Definition: MIRYamlMapping.h:695
llvm::MachineFrameInfo::getLocalFrameSize
int64_t getLocalFrameSize() const
Get the size of the local object blob.
Definition: MachineFrameInfo.h:437
llvm::MachineInstr
Representation of each machine instruction.
Definition: MachineInstr.h:66
llvm::MachineFunction::callsEHReturn
bool callsEHReturn() const
Definition: MachineFunction.h:1087
llvm::yaml::MachineConstantPoolValue::IsTargetSpecific
bool IsTargetSpecific
Definition: MIRYamlMapping.h:525
llvm::MachineFrameInfo::getObjectSize
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
Definition: MachineFrameInfo.h:469
llvm::yaml::MachineFrameInfo::LocalFrameSize
unsigned LocalFrameSize
Definition: MIRYamlMapping.h:615
llvm::GlobalValue::getParent
Module * getParent()
Get the module that this global value is contained inside of...
Definition: GlobalValue.h:644
llvm::yaml::MachineFrameInfo::FunctionContext
StringValue FunctionContext
Definition: MIRYamlMapping.h:608
llvm::MachineFrameInfo::hasStackProtectorIndex
bool hasStackProtectorIndex() const
Definition: MachineFrameInfo.h:359
llvm::MachineInstr::FmReassoc
@ FmReassoc
Definition: MachineInstr.h:102
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:67
llvm::DenseMap< const uint32_t *, unsigned >
llvm::MachineRegisterInfo::getCalleeSavedRegs
const MCPhysReg * getCalleeSavedRegs() const
Returns list of callee saved registers.
Definition: MachineRegisterInfo.cpp:623
llvm::MachineConstantPool
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
Definition: MachineConstantPool.h:117
llvm::yaml::MachineFunction::FailsVerification
bool FailsVerification
Definition: MIRYamlMapping.h:707
llvm::MachineOperand::MO_Predicate
@ MO_Predicate
Generic predicate for ISel.
Definition: MachineOperand.h:69
MIRPrinter.h
I
#define I(x, y, z)
Definition: MD5.cpp:58
llvm::MachineFunctionProperties::Property::TracksDebugUserValues
@ TracksDebugUserValues
llvm::MachineFunction::getCallSitesInfo
const CallSiteInfoMap & getCallSitesInfo() const
Definition: MachineFunction.h:1245
llvm::MachineFrameInfo::getObjectAlign
Align getObjectAlign(int ObjectIdx) const
Return the alignment of the specified stack object.
Definition: MachineFrameInfo.h:483
llvm::MachineOperand::MO_MCSymbol
@ MO_MCSymbol
MCSymbol reference (for debug/eh info)
Definition: MachineOperand.h:66
llvm::yaml::FixedMachineStackObject::Size
uint64_t Size
Definition: MIRYamlMapping.h:313
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:439
MachineConstantPool.h
llvm::StringRef::lower
std::string lower() const
Definition: StringRef.cpp:112
llvm::is_contained
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.
Definition: STLExtras.h:1673
llvm::MachineRegisterInfo::liveins
ArrayRef< std::pair< MCRegister, Register > > liveins() const
Definition: MachineRegisterInfo.h:971
llvm::Value::print
void print(raw_ostream &O, bool IsForDebug=false) const
Implement operator<< on Value.
Definition: AsmWriter.cpp:4594
llvm::MachineBasicBlock::getLastNonDebugInstr
iterator getLastNonDebugInstr(bool SkipPseudoOp=true)
Returns an iterator to the last non-debug instruction in the basic block, or end().
Definition: MachineBasicBlock.cpp:263
llvm::MachineFunctionProperties::Property::RegBankSelected
@ RegBankSelected
llvm::yaml::MachineFunctionLiveIn::VirtualRegister
StringValue VirtualRegister
Definition: MIRYamlMapping.h:214
llvm::yaml::MachineFunction
Definition: MIRYamlMapping.h:688
llvm::DenseMapBase::find
iterator find(const_arg_type_t< KeyT > Val)
Definition: DenseMap.h:150
llvm::MachineFunction::getName
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
Definition: MachineFunction.cpp:567
llvm::yaml::MachineFunction::FixedStackObjects
std::vector< FixedMachineStackObject > FixedStackObjects
Definition: MIRYamlMapping.h:715
llvm::MIPrinter
This class prints out the machine instructions using the MIR serialization format.
Definition: MIRPrinter.cpp:135
llvm::MachineFunction::getConstantPool
MachineConstantPool * getConstantPool()
getConstantPool - Return the constant pool object for the current function.
Definition: MachineFunction.h:688
printCustomRegMask
static void printCustomRegMask(const uint32_t *RegMask, raw_ostream &OS, const TargetRegisterInfo *TRI)
Definition: MIRPrinter.cpp:260
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:77
llvm::MachineBasicBlock::succ_begin
succ_iterator succ_begin()
Definition: MachineBasicBlock.h:369
llvm::MachineFunction::getFrameInfo
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
Definition: MachineFunction.h:672
llvm::MachineBasicBlock::getParent
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
Definition: MachineBasicBlock.h:261
llvm::MachineOperand::MO_TargetIndex
@ MO_TargetIndex
Target-dependent index+offset operand.
Definition: MachineOperand.h:58
llvm::MachineOperand::MO_FPImmediate
@ MO_FPImmediate
Floating-point immediate operand.
Definition: MachineOperand.h:54
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
llvm::MDNode
Metadata node.
Definition: Metadata.h:944
llvm::MachineBasicBlock::instr_begin
instr_iterator instr_begin()
Definition: MachineBasicBlock.h:289
llvm::yaml::StringValue
A wrapper around std::string which contains a source range that's being set during parsing.
Definition: MIRYamlMapping.h:34
isReg
static bool isReg(const MCInst &MI, unsigned OpNo)
Definition: MipsInstPrinter.cpp:31
llvm::Value::printAsOperand
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.
Definition: AsmWriter.cpp:4677
llvm::yaml::MachineStackObject::SpillSlot
@ SpillSlot
Definition: MIRYamlMapping.h:241
llvm::Module::print
void print(raw_ostream &OS, AssemblyAnnotationWriter *AAW, bool ShouldPreserveUseListOrder=false, bool IsForDebug=false) const
Print the module to an output stream with an optional AssemblyAnnotationWriter.
Definition: AsmWriter.cpp:4511
llvm::MachineBasicBlock::instr_end
instr_iterator instr_end()
Definition: MachineBasicBlock.h:291
llvm::MachineFunction
Definition: MachineFunction.h:257
llvm::yaml::MachineFrameInfo::HasOpaqueSPAdjustment
bool HasOpaqueSPAdjustment
Definition: MIRYamlMapping.h:611
llvm::yaml::VirtualRegisterDefinition::Class
StringValue Class
Definition: MIRYamlMapping.h:190
YAMLTraits.h
llvm::MachineInstr::IsExact
@ IsExact
Definition: MachineInstr.h:108
llvm::MachineBasicBlock::succ_empty
bool succ_empty() const
Definition: MachineBasicBlock.h:384
llvm::MachineOperand::MO_JumpTableIndex
@ MO_JumpTableIndex
Address of indexed Jump Table for switch.
Definition: MachineOperand.h:59
llvm::MachineBasicBlock::PrintNameIr
@ PrintNameIr
Add IR name where available.
Definition: MachineBasicBlock.h:1103
llvm::MachineFrameInfo::getCalleeSavedInfo
const std::vector< CalleeSavedInfo > & getCalleeSavedInfo() const
Returns a reference to call saved info vector for the current function.
Definition: MachineFrameInfo.h:779
llvm::MachineOperand::MO_CImmediate
@ MO_CImmediate
Immediate >64bit operand.
Definition: MachineOperand.h:53
llvm::printRegClassOrBank
Printable printRegClassOrBank(Register Reg, const MachineRegisterInfo &RegInfo, const TargetRegisterInfo *TRI)
Create Printable object to print register classes or register banks on a raw_ostream.
Definition: TargetRegisterInfo.cpp:175
llvm::yaml::MachineJumpTable::Entries
std::vector< Entry > Entries
Definition: MIRYamlMapping.h:554
llvm::yaml::MachineFrameInfo::MaxCallFrameSize
unsigned MaxCallFrameSize
~0u means: not computed yet.
Definition: MIRYamlMapping.h:609
llvm::yaml::MachineFunction::Legalized
bool Legalized
Definition: MIRYamlMapping.h:693
llvm::MachineFrameInfo::hasPatchPoint
bool hasPatchPoint() const
This method may be called any time after instruction selection is complete to determine if there is a...
Definition: MachineFrameInfo.h:388
llvm::MachineBasicBlock::getNumber
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
Definition: MachineBasicBlock.h:1115
llvm::yaml::BlockScalarTraits< Module >::output
static void output(const Module &Mod, void *Ctxt, raw_ostream &OS)
Definition: MIRPrinter.cpp:170
llvm::MachineBasicBlock::PrintNameAttributes
@ PrintNameAttributes
Print attributes.
Definition: MachineBasicBlock.h:1104
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
llvm::yaml::MachineJumpTable::Kind
MachineJumpTableInfo::JTEntryKind Kind
Definition: MIRYamlMapping.h:553
llvm::MachineFunction::VariableDbgInfo::Loc
const DILocation * Loc
Definition: MachineFunction.h:409
llvm::MachineBasicBlock::liveins_dbg
iterator_range< livein_iterator > liveins_dbg() const
Definition: MachineBasicBlock.h:442
llvm::yaml::MachineStackObject::Type
ObjectType Type
Definition: MIRYamlMapping.h:245
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:143
llvm::yaml::MachineFunction::FailedISel
bool FailedISel
Definition: MIRYamlMapping.h:696
uint32_t
llvm::MachineOperand::MO_MachineBasicBlock
@ MO_MachineBasicBlock
MachineBasicBlock reference.
Definition: MachineOperand.h:55
llvm::MachineInstr::NoMerge
@ NoMerge
Definition: MachineInstr.h:112
llvm::ilist_node_impl::getIterator
self_iterator getIterator()
Definition: ilist_node.h:82
TargetSubtargetInfo.h
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::ModuleSlotTracker::MachineMDNodeListType
std::vector< std::pair< unsigned, const MDNode * > > MachineMDNodeListType
Definition: ModuleSlotTracker.h:102
llvm::MachineOperand::MO_IntrinsicID
@ MO_IntrinsicID
Intrinsic ID for ISel.
Definition: MachineOperand.h:68
llvm::format
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
Definition: Format.h:124
llvm::yaml::MachineFrameInfo::HasStackMap
bool HasStackMap
Definition: MIRYamlMapping.h:600
llvm::yaml::MachineFunction::HasEHScopes
bool HasEHScopes
Definition: MIRYamlMapping.h:704
llvm::MIPrinter::print
void print(const MachineBasicBlock &MBB)
Definition: MIRPrinter.cpp:659
llvm::Value::getName
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:308
llvm::DenseMapBase::insert
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
Definition: DenseMap.h:207
llvm::MachineFrameInfo::getLocalFrameObjectCount
int64_t getLocalFrameObjectCount() const
Return the number of objects allocated into the local object block.
Definition: MachineFrameInfo.h:431
MRI
unsigned const MachineRegisterInfo * MRI
Definition: AArch64AdvSIMDScalarPass.cpp:105
llvm::MachineFrameInfo::getMaxAlign
Align getMaxAlign() const
Return the alignment in bytes that this function must be aligned to, which is greater than the defaul...
Definition: MachineFrameInfo.h:593
llvm::yaml::MachineFrameInfo
Serializable representation of MachineFrameInfo.
Definition: MIRYamlMapping.h:597
llvm::MachineFrameInfo::isFrameAddressTaken
bool isFrameAddressTaken() const
This method may be called any time after instruction selection is complete to determine if there is a...
Definition: MachineFrameInfo.h:370
llvm::yaml::MachineFrameInfo::IsFrameAddressTaken
bool IsFrameAddressTaken
Definition: MIRYamlMapping.h:598
llvm::MachineFrameInfo::hasCalls
bool hasCalls() const
Return true if the current function has any function calls.
Definition: MachineFrameInfo.h:605
llvm::yaml::MachineFunction::DebugValueSubstitutions
std::vector< DebugValueSubstitution > DebugValueSubstitutions
Definition: MIRYamlMapping.h:720
llvm::MIRPrinter::convertMachineMetadataNodes
void convertMachineMetadataNodes(yaml::MachineFunction &YMF, const MachineFunction &MF, MachineModuleSlotTracker &MST)
Definition: MIRPrinter.cpp:542
llvm::ISD::FrameIndex
@ FrameIndex
Definition: ISDOpcodes.h:80
MBB
MachineBasicBlock & MBB
Definition: AArch64SLSHardening.cpp:74
llvm::yaml::MachineFunction::VirtualRegisters
std::vector< VirtualRegisterDefinition > VirtualRegisters
Definition: MIRYamlMapping.h:709
llvm::yaml::MachineFunction::ExposesReturnsTwice
bool ExposesReturnsTwice
Definition: MIRYamlMapping.h:691
llvm::MachineFunctionProperties::Property::FailedISel
@ FailedISel
llvm::MachineOperand::printTargetFlags
static void printTargetFlags(raw_ostream &OS, const MachineOperand &Op)
Print operand target flags.
Definition: MachineOperand.cpp:540
llvm::MachineFrameInfo::getSavePoint
MachineBasicBlock * getSavePoint() const
Definition: MachineFrameInfo.h:796
formatOperandComment
static std::string formatOperandComment(std::string Comment)
Definition: MIRPrinter.cpp:875
llvm::MachineRegisterInfo::getSimpleHint
Register getSimpleHint(Register VReg) const
getSimpleHint - same as getRegAllocationHint except it will only return a target independent hint.
Definition: MachineRegisterInfo.h:818
llvm::yaml::MachineFrameInfo::IsReturnAddressTaken
bool IsReturnAddressTaken
Definition: MIRYamlMapping.h:599
llvm::MachineConstantPoolEntry
This class is a data container for one entry in a MachineConstantPool.
Definition: MachineConstantPool.h:67
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:50
llvm::yaml::FixedMachineStackObject::IsAliased
bool IsAliased
Definition: MIRYamlMapping.h:317
llvm::MachineFunction::getFunction
Function & getFunction()
Return the LLVM function that this machine code represents.
Definition: MachineFunction.h:622
uint16_t
llvm::MachineFunction::getTarget
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
Definition: MachineFunction.h:652
llvm::MIRPrinter::MIRPrinter
MIRPrinter(raw_ostream &OS)
Definition: MIRPrinter.cpp:108
llvm::DenseMapBase::end
iterator end()
Definition: DenseMap.h:84
llvm::AMDGPU::SendMsg::Op
Op
Definition: SIDefines.h:348
llvm::MachineFrameInfo::isVariableSizedObjectIndex
bool isVariableSizedObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a variable sized object.
Definition: MachineFrameInfo.h:745
llvm::ilist_iterator
Iterator for intrusive lists based on ilist_node.
Definition: ilist_iterator.h:57
MachineFrameInfo.h
llvm::Align::value
uint64_t value() const
This is a hole in the type system and should not be abused.
Definition: Alignment.h:85
llvm::yaml::StringValue::Value
std::string Value
Definition: MIRYamlMapping.h:35
llvm::MachineOperand::MO_ExternalSymbol
@ MO_ExternalSymbol
Name of external global symbol.
Definition: MachineOperand.h:60
llvm::yaml::MachineStackObject::ID
UnsignedValue ID
Definition: MIRYamlMapping.h:242
Casting.h
llvm::yaml::FixedMachineStackObject::Offset
int64_t Offset
Definition: MIRYamlMapping.h:312
Function.h
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
llvm::yaml::MachineStackObject::Size
uint64_t Size
Definition: MIRYamlMapping.h:247
llvm::yaml::MachineFunction::TracksDebugUserValues
bool TracksDebugUserValues
Definition: MIRYamlMapping.h:708
llvm::MachineInstr::FmNoNans
@ FmNoNans
Definition: MachineInstr.h:90
llvm::MachineInstr::FmContract
@ FmContract
Definition: MachineInstr.h:98
llvm::MachineFrameInfo::isSpillSlotObjectIndex
bool isSpillSlotObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a spill slot.
Definition: MachineFrameInfo.h:710
llvm::MachineFunction::hasEHFunclets
bool hasEHFunclets() const
Definition: MachineFunction.h:1099
llvm::MachineBasicBlock::livein_empty
bool livein_empty() const
Definition: MachineBasicBlock.h:448
llvm::yaml::MachineConstantPoolValue::Alignment
MaybeAlign Alignment
Definition: MIRYamlMapping.h:524
llvm::yaml::MachineFunction::LiveIns
std::vector< MachineFunctionLiveIn > LiveIns
Definition: MIRYamlMapping.h:710
llvm::yaml::MachineFrameInfo::SavePoint
StringValue SavePoint
Definition: MIRYamlMapping.h:616
llvm::MachineFrameInfo::isImmutableObjectIndex
bool isImmutableObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to an immutable object.
Definition: MachineFrameInfo.h:693
llvm::yaml::MachineFunction::HasWinCFI
bool HasWinCFI
Definition: MIRYamlMapping.h:699
llvm::MachineFrameInfo
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
Definition: MachineFrameInfo.h:105
llvm::yaml::CallSiteInfo::MachineInstrLoc::BlockNum
unsigned BlockNum
Definition: MIRYamlMapping.h:445
Instructions.h
llvm::yaml::MachineFrameInfo::HasTailCall
bool HasTailCall
Definition: MIRYamlMapping.h:614
llvm::yaml::MachineFunction::Body
BlockStringValue Body
Definition: MIRYamlMapping.h:723
llvm::yaml::VirtualRegisterDefinition::ID
UnsignedValue ID
Definition: MIRYamlMapping.h:189
llvm::BranchProbability::normalizeProbabilities
static void normalizeProbabilities(ProbabilityIter Begin, ProbabilityIter End)
Definition: BranchProbability.h:205
SmallVector.h
llvm::yaml::MachineFunctionLiveIn
Definition: MIRYamlMapping.h:212
llvm::yaml::MachineFrameInfo::MaxAlignment
unsigned MaxAlignment
Definition: MIRYamlMapping.h:604
llvm::yaml::MachineFrameInfo::HasMustTailInVarArgFunc
bool HasMustTailInVarArgFunc
Definition: MIRYamlMapping.h:613
llvm::MachineInstr::NoUWrap
@ NoUWrap
Definition: MachineInstr.h:104
llvm::raw_ostream::indent
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
Definition: raw_ostream.cpp:494
SmallBitVector.h
llvm::MachineFunction::DebugValueSubstitutions
SmallVector< DebugSubstitution, 8 > DebugValueSubstitutions
Debug value substitutions: a collection of DebugSubstitution objects, recording changes in where a va...
Definition: MachineFunction.h:505
llvm::MachineInstr::BundledSucc
@ BundledSucc
Definition: MachineInstr.h:89
LaneBitmask.h
llvm::yaml::MachineFunction::MachineMetadataNodes
std::vector< StringValue > MachineMetadataNodes
Definition: MIRYamlMapping.h:722
llvm::yaml::MachineConstantPoolValue
Definition: MIRYamlMapping.h:521
llvm::MachineInstr::FmArcp
@ FmArcp
Definition: MachineInstr.h:96
ModuleSlotTracker.h
MachineMemOperand.h
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:42
MachineOperand.h
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
llvm::yaml::MachineFrameInfo::HasPatchPoint
bool HasPatchPoint
Definition: MIRYamlMapping.h:601
llvm::MachineFrameInfo::hasOpaqueSPAdjustment
bool hasOpaqueSPAdjustment() const
Returns true if the function contains opaque dynamic stack adjustments.
Definition: MachineFrameInfo.h:609
llvm::yaml::CallSiteInfo::MachineInstrLoc
Identifies call instruction location in machine function.
Definition: MIRYamlMapping.h:444
llvm::MachineFunction::VariableDbgInfo::Var
const DILocalVariable * Var
Definition: MachineFunction.h:405
llvm::MachineFrameInfo::getStackProtectorIndex
int getStackProtectorIndex() const
Return the index for the stack protector object.
Definition: MachineFrameInfo.h:357
llvm::MachineFrameInfo::hasStackMap
bool hasStackMap() const
This method may be called any time after instruction selection is complete to determine if there is a...
Definition: MachineFrameInfo.h:382
llvm::MachineFunction::getJumpTableInfo
const MachineJumpTableInfo * getJumpTableInfo() const
getJumpTableInfo - Return the jump table info object for the current function.
Definition: MachineFunction.h:679
llvm::DebugLoc
A debug info location.
Definition: DebugLoc.h:33
llvm::MachineFrameInfo::adjustsStack
bool adjustsStack() const
Return true if this function adjusts the stack – e.g., when calling another function.
Definition: MachineFrameInfo.h:601
llvm::MachineOperand::MO_RegisterMask
@ MO_RegisterMask
Mask of preserved registers.
Definition: MachineOperand.h:63
llvm::MachineFrameInfo::hasTailCall
bool hasTailCall() const
Returns true if the function contains a tail call.
Definition: MachineFrameInfo.h:630
llvm::cl::desc
Definition: CommandLine.h:412
Mod
Module * Mod
Definition: PassBuilderBindings.cpp:54
llvm::MachineFunction::hasEHScopes
bool hasEHScopes() const
Definition: MachineFunction.h:1096
llvm::MachineJumpTableInfo
Definition: MachineJumpTableInfo.h:42
raw_ostream.h
llvm::MachineFunction::VariableDbgInfo
Definition: MachineFunction.h:404
llvm::yaml::MachineFunction::CallSitesInfo
std::vector< CallSiteInfo > CallSitesInfo
Definition: MIRYamlMapping.h:719
MachineFunction.h
llvm::printReg
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.
Definition: TargetRegisterInfo.cpp:111
llvm::SmallVectorImpl::reserve
void reserve(size_type N)
Definition: SmallVector.h:649
llvm::MachineInstrBundleIterator< const MachineInstr >
Value.h
llvm::MachineFunction::getAlignment
Align getAlignment() const
getAlignment - Return the alignment of the function.
Definition: MachineFunction.h:704
llvm::raw_string_ostream::str
std::string & str()
Returns the string's reference.
Definition: raw_ostream.h:646
llvm::yaml::MachineFunction::CallsEHReturn
bool CallsEHReturn
Definition: MIRYamlMapping.h:701
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
TargetRegisterInfo.h
llvm::MachineModuleSlotTracker::collectMachineMDNodes
void collectMachineMDNodes(MachineMDNodeListType &L) const
Definition: MachineModuleSlotTracker.cpp:60
llvm::MachineBasicBlock::end
iterator end()
Definition: MachineBasicBlock.h:307
llvm::yaml::BlockStringValue::Value
StringValue Value
Definition: MIRYamlMapping.h:81
llvm::yaml::MachineFunction::HasEHCatchret
bool HasEHCatchret
Definition: MIRYamlMapping.h:703
llvm::MIRPrinter::convertCallSiteObjects
void convertCallSiteObjects(yaml::MachineFunction &YMF, const MachineFunction &MF, ModuleSlotTracker &MST)
Definition: MIRPrinter.cpp:508
llvm::TargetRegisterInfo::getRegMasks
virtual ArrayRef< const uint32_t * > getRegMasks() const =0
Return all the call-preserved register masks defined for this target.
llvm::yaml::MachineFunction::Constants
std::vector< MachineConstantPoolValue > Constants
Definition: MIRYamlMapping.h:717
llvm::MachineFrameInfo::getFunctionContextIndex
int getFunctionContextIndex() const
Return the index for the function context object.
Definition: MachineFrameInfo.h:363
llvm::yaml::CallSiteInfo::ArgRegPair
Definition: MIRYamlMapping.h:434
llvm::SmallPtrSetImpl::insert
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
Definition: SmallPtrSet.h:365
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:38
llvm::MachineFunctionProperties::Property::Legalized
@ Legalized
llvm::MachineOperand::MO_ConstantPoolIndex
@ MO_ConstantPoolIndex
Address of indexed Constant in Constant Pool.
Definition: MachineOperand.h:57
llvm::MachineFrameInfo::getObjectAllocation
const AllocaInst * getObjectAllocation(int ObjectIdx) const
Return the underlying Alloca of the specified stack object if it exists.
Definition: MachineFrameInfo.h:502
llvm::LLT
Definition: LowLevelTypeImpl.h:39
llvm::yaml::MachineStackObject::Name
StringValue Name
Definition: MIRYamlMapping.h:243