LLVM  14.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/None.h"
17 #include "llvm/ADT/STLExtras.h"
19 #include "llvm/ADT/SmallPtrSet.h"
20 #include "llvm/ADT/SmallVector.h"
21 #include "llvm/ADT/StringRef.h"
22 #include "llvm/ADT/Twine.h"
40 #include "llvm/IR/BasicBlock.h"
41 #include "llvm/IR/Constants.h"
42 #include "llvm/IR/DebugInfo.h"
43 #include "llvm/IR/DebugLoc.h"
44 #include "llvm/IR/Function.h"
45 #include "llvm/IR/GlobalValue.h"
47 #include "llvm/IR/InstrTypes.h"
48 #include "llvm/IR/Instructions.h"
49 #include "llvm/IR/Intrinsics.h"
50 #include "llvm/IR/Module.h"
52 #include "llvm/IR/Value.h"
53 #include "llvm/MC/LaneBitmask.h"
54 #include "llvm/MC/MCContext.h"
55 #include "llvm/MC/MCDwarf.h"
56 #include "llvm/MC/MCSymbol.h"
59 #include "llvm/Support/Casting.h"
62 #include "llvm/Support/Format.h"
68 #include <algorithm>
69 #include <cassert>
70 #include <cinttypes>
71 #include <cstdint>
72 #include <iterator>
73 #include <string>
74 #include <utility>
75 #include <vector>
76 
77 using namespace llvm;
78 
80  "simplify-mir", cl::Hidden,
81  cl::desc("Leave out unnecessary information when printing MIR"));
82 
83 static cl::opt<bool> PrintLocations("mir-debug-loc", cl::Hidden, cl::init(true),
84  cl::desc("Print MIR debug-locations"));
85 
86 namespace {
87 
88 /// This structure describes how to print out stack object references.
89 struct FrameIndexOperand {
90  std::string Name;
91  unsigned ID;
92  bool IsFixed;
93 
94  FrameIndexOperand(StringRef Name, unsigned ID, bool IsFixed)
95  : Name(Name.str()), ID(ID), IsFixed(IsFixed) {}
96 
97  /// Return an ordinary stack object reference.
98  static FrameIndexOperand create(StringRef Name, unsigned ID) {
99  return FrameIndexOperand(Name, ID, /*IsFixed=*/false);
100  }
101 
102  /// Return a fixed stack object reference.
103  static FrameIndexOperand createFixed(unsigned ID) {
104  return FrameIndexOperand("", ID, /*IsFixed=*/true);
105  }
106 };
107 
108 } // end anonymous namespace
109 
110 namespace llvm {
111 
112 /// This class prints out the machine functions using the MIR serialization
113 /// format.
114 class MIRPrinter {
115  raw_ostream &OS;
116  DenseMap<const uint32_t *, unsigned> RegisterMaskIds;
117  /// Maps from stack object indices to operand indices which will be used when
118  /// printing frame index machine operands.
119  DenseMap<int, FrameIndexOperand> StackObjectOperandMapping;
120 
121 public:
122  MIRPrinter(raw_ostream &OS) : OS(OS) {}
123 
124  void print(const MachineFunction &MF);
125 
126  void convert(yaml::MachineFunction &MF, const MachineRegisterInfo &RegInfo,
127  const TargetRegisterInfo *TRI);
129  const MachineFrameInfo &MFI);
133  const MachineJumpTableInfo &JTI);
135  const MachineFunction &MF, ModuleSlotTracker &MST);
137  const MachineFunction &MF,
138  ModuleSlotTracker &MST);
140  const MachineFunction &MF,
142 
143 private:
144  void initRegisterMaskIds(const MachineFunction &MF);
145 };
146 
147 /// This class prints out the machine instructions using the MIR serialization
148 /// format.
149 class MIPrinter {
150  raw_ostream &OS;
151  ModuleSlotTracker &MST;
152  const DenseMap<const uint32_t *, unsigned> &RegisterMaskIds;
153  const DenseMap<int, FrameIndexOperand> &StackObjectOperandMapping;
154  /// Synchronization scope names registered with LLVMContext.
156 
157  bool canPredictBranchProbabilities(const MachineBasicBlock &MBB) const;
158  bool canPredictSuccessors(const MachineBasicBlock &MBB) const;
159 
160 public:
162  const DenseMap<const uint32_t *, unsigned> &RegisterMaskIds,
163  const DenseMap<int, FrameIndexOperand> &StackObjectOperandMapping)
164  : OS(OS), MST(MST), RegisterMaskIds(RegisterMaskIds),
165  StackObjectOperandMapping(StackObjectOperandMapping) {}
166 
167  void print(const MachineBasicBlock &MBB);
168 
169  void print(const MachineInstr &MI);
171  void print(const MachineInstr &MI, unsigned OpIdx,
172  const TargetRegisterInfo *TRI, const TargetInstrInfo *TII,
173  bool ShouldPrintRegisterTies, LLT TypeToPrint,
174  bool PrintDef = true);
175 };
176 
177 } // end namespace llvm
178 
179 namespace llvm {
180 namespace yaml {
181 
182 /// This struct serializes the LLVM IR module.
183 template <> struct BlockScalarTraits<Module> {
184  static void output(const Module &Mod, void *Ctxt, raw_ostream &OS) {
185  Mod.print(OS, nullptr);
186  }
187 
188  static StringRef input(StringRef Str, void *Ctxt, Module &Mod) {
189  llvm_unreachable("LLVM Module is supposed to be parsed separately");
190  return "";
191  }
192 };
193 
194 } // end namespace yaml
195 } // end namespace llvm
196 
197 static void printRegMIR(unsigned Reg, yaml::StringValue &Dest,
198  const TargetRegisterInfo *TRI) {
199  raw_string_ostream OS(Dest.Value);
200  OS << printReg(Reg, TRI);
201 }
202 
204  initRegisterMaskIds(MF);
205 
206  yaml::MachineFunction YamlMF;
207  YamlMF.Name = MF.getName();
208  YamlMF.Alignment = MF.getAlignment();
210  YamlMF.HasWinCFI = MF.hasWinCFI();
211 
212  YamlMF.Legalized = MF.getProperties().hasProperty(
216  YamlMF.Selected = MF.getProperties().hasProperty(
218  YamlMF.FailedISel = MF.getProperties().hasProperty(
220 
221  convert(YamlMF, MF.getRegInfo(), MF.getSubtarget().getRegisterInfo());
222  MachineModuleSlotTracker MST(&MF);
224  convert(MST, YamlMF.FrameInfo, MF.getFrameInfo());
225  convertStackObjects(YamlMF, MF, MST);
226  convertCallSiteObjects(YamlMF, MF, MST);
227  for (const auto &Sub : MF.DebugValueSubstitutions) {
228  const auto &SubSrc = Sub.Src;
229  const auto &SubDest = Sub.Dest;
230  YamlMF.DebugValueSubstitutions.push_back({SubSrc.first, SubSrc.second,
231  SubDest.first,
232  SubDest.second,
233  Sub.Subreg});
234  }
235  if (const auto *ConstantPool = MF.getConstantPool())
236  convert(YamlMF, *ConstantPool);
237  if (const auto *JumpTableInfo = MF.getJumpTableInfo())
238  convert(MST, YamlMF.JumpTableInfo, *JumpTableInfo);
239 
240  const TargetMachine &TM = MF.getTarget();
241  YamlMF.MachineFuncInfo =
242  std::unique_ptr<yaml::MachineFunctionInfo>(TM.convertFuncInfoToYAML(MF));
243 
244  raw_string_ostream StrOS(YamlMF.Body.Value.Value);
245  bool IsNewlineNeeded = false;
246  for (const auto &MBB : MF) {
247  if (IsNewlineNeeded)
248  StrOS << "\n";
249  MIPrinter(StrOS, MST, RegisterMaskIds, StackObjectOperandMapping)
250  .print(MBB);
251  IsNewlineNeeded = true;
252  }
253  StrOS.flush();
254  // Convert machine metadata collected during the print of the machine
255  // function.
256  convertMachineMetadataNodes(YamlMF, MF, MST);
257 
258  yaml::Output Out(OS);
259  if (!SimplifyMIR)
260  Out.setWriteDefaultValues(true);
261  Out << YamlMF;
262 }
263 
264 static void printCustomRegMask(const uint32_t *RegMask, raw_ostream &OS,
265  const TargetRegisterInfo *TRI) {
266  assert(RegMask && "Can't print an empty register mask");
267  OS << StringRef("CustomRegMask(");
268 
269  bool IsRegInRegMaskFound = false;
270  for (int I = 0, E = TRI->getNumRegs(); I < E; I++) {
271  // Check whether the register is asserted in regmask.
272  if (RegMask[I / 32] & (1u << (I % 32))) {
273  if (IsRegInRegMaskFound)
274  OS << ',';
275  OS << printReg(I, TRI);
276  IsRegInRegMaskFound = true;
277  }
278  }
279 
280  OS << ')';
281 }
282 
283 static void printRegClassOrBank(unsigned Reg, yaml::StringValue &Dest,
284  const MachineRegisterInfo &RegInfo,
285  const TargetRegisterInfo *TRI) {
286  raw_string_ostream OS(Dest.Value);
287  OS << printRegClassOrBank(Reg, RegInfo, TRI);
288 }
289 
290 template <typename T>
291 static void
293  T &Object, ModuleSlotTracker &MST) {
294  std::array<std::string *, 3> Outputs{{&Object.DebugVar.Value,
295  &Object.DebugExpr.Value,
296  &Object.DebugLoc.Value}};
297  std::array<const Metadata *, 3> Metas{{DebugVar.Var,
298  DebugVar.Expr,
299  DebugVar.Loc}};
300  for (unsigned i = 0; i < 3; ++i) {
301  raw_string_ostream StrOS(*Outputs[i]);
302  Metas[i]->printAsOperand(StrOS, MST);
303  }
304 }
305 
307  const MachineRegisterInfo &RegInfo,
308  const TargetRegisterInfo *TRI) {
309  MF.TracksRegLiveness = RegInfo.tracksLiveness();
310 
311  // Print the virtual register definitions.
312  for (unsigned I = 0, E = RegInfo.getNumVirtRegs(); I < E; ++I) {
313  unsigned Reg = Register::index2VirtReg(I);
315  VReg.ID = I;
316  if (RegInfo.getVRegName(Reg) != "")
317  continue;
318  ::printRegClassOrBank(Reg, VReg.Class, RegInfo, TRI);
319  unsigned PreferredReg = RegInfo.getSimpleHint(Reg);
320  if (PreferredReg)
321  printRegMIR(PreferredReg, VReg.PreferredRegister, TRI);
322  MF.VirtualRegisters.push_back(VReg);
323  }
324 
325  // Print the live ins.
326  for (std::pair<unsigned, unsigned> LI : RegInfo.liveins()) {
328  printRegMIR(LI.first, LiveIn.Register, TRI);
329  if (LI.second)
330  printRegMIR(LI.second, LiveIn.VirtualRegister, TRI);
331  MF.LiveIns.push_back(LiveIn);
332  }
333 
334  // Prints the callee saved registers.
335  if (RegInfo.isUpdatedCSRsInitialized()) {
336  const MCPhysReg *CalleeSavedRegs = RegInfo.getCalleeSavedRegs();
337  std::vector<yaml::FlowStringValue> CalleeSavedRegisters;
338  for (const MCPhysReg *I = CalleeSavedRegs; *I; ++I) {
340  printRegMIR(*I, Reg, TRI);
341  CalleeSavedRegisters.push_back(Reg);
342  }
343  MF.CalleeSavedRegisters = CalleeSavedRegisters;
344  }
345 }
346 
348  yaml::MachineFrameInfo &YamlMFI,
349  const MachineFrameInfo &MFI) {
352  YamlMFI.HasStackMap = MFI.hasStackMap();
353  YamlMFI.HasPatchPoint = MFI.hasPatchPoint();
354  YamlMFI.StackSize = MFI.getStackSize();
355  YamlMFI.OffsetAdjustment = MFI.getOffsetAdjustment();
356  YamlMFI.MaxAlignment = MFI.getMaxAlign().value();
357  YamlMFI.AdjustsStack = MFI.adjustsStack();
358  YamlMFI.HasCalls = MFI.hasCalls();
360  ? MFI.getMaxCallFrameSize() : ~0u;
364  YamlMFI.HasVAStart = MFI.hasVAStart();
366  YamlMFI.HasTailCall = MFI.hasTailCall();
367  YamlMFI.LocalFrameSize = MFI.getLocalFrameSize();
368  if (MFI.getSavePoint()) {
369  raw_string_ostream StrOS(YamlMFI.SavePoint.Value);
370  StrOS << printMBBReference(*MFI.getSavePoint());
371  }
372  if (MFI.getRestorePoint()) {
373  raw_string_ostream StrOS(YamlMFI.RestorePoint.Value);
374  StrOS << printMBBReference(*MFI.getRestorePoint());
375  }
376 }
377 
379  const MachineFunction &MF,
380  ModuleSlotTracker &MST) {
381  const MachineFrameInfo &MFI = MF.getFrameInfo();
383 
384  // Process fixed stack objects.
385  assert(YMF.FixedStackObjects.empty());
386  SmallVector<int, 32> FixedStackObjectsIdx;
387  const int BeginIdx = MFI.getObjectIndexBegin();
388  if (BeginIdx < 0)
389  FixedStackObjectsIdx.reserve(-BeginIdx);
390 
391  unsigned ID = 0;
392  for (int I = BeginIdx; I < 0; ++I, ++ID) {
393  FixedStackObjectsIdx.push_back(-1); // Fill index for possible dead.
394  if (MFI.isDeadObjectIndex(I))
395  continue;
396 
398  YamlObject.ID = ID;
399  YamlObject.Type = MFI.isSpillSlotObjectIndex(I)
402  YamlObject.Offset = MFI.getObjectOffset(I);
403  YamlObject.Size = MFI.getObjectSize(I);
404  YamlObject.Alignment = MFI.getObjectAlign(I);
405  YamlObject.StackID = (TargetStackID::Value)MFI.getStackID(I);
406  YamlObject.IsImmutable = MFI.isImmutableObjectIndex(I);
407  YamlObject.IsAliased = MFI.isAliasedObjectIndex(I);
408  // Save the ID' position in FixedStackObjects storage vector.
409  FixedStackObjectsIdx[ID] = YMF.FixedStackObjects.size();
410  YMF.FixedStackObjects.push_back(YamlObject);
411  StackObjectOperandMapping.insert(
412  std::make_pair(I, FrameIndexOperand::createFixed(ID)));
413  }
414 
415  // Process ordinary stack objects.
416  assert(YMF.StackObjects.empty());
417  SmallVector<unsigned, 32> StackObjectsIdx;
418  const int EndIdx = MFI.getObjectIndexEnd();
419  if (EndIdx > 0)
420  StackObjectsIdx.reserve(EndIdx);
421  ID = 0;
422  for (int I = 0; I < EndIdx; ++I, ++ID) {
423  StackObjectsIdx.push_back(-1); // Fill index for possible dead.
424  if (MFI.isDeadObjectIndex(I))
425  continue;
426 
427  yaml::MachineStackObject YamlObject;
428  YamlObject.ID = ID;
429  if (const auto *Alloca = MFI.getObjectAllocation(I))
430  YamlObject.Name.Value = std::string(
431  Alloca->hasName() ? Alloca->getName() : "");
432  YamlObject.Type = MFI.isSpillSlotObjectIndex(I)
437  YamlObject.Offset = MFI.getObjectOffset(I);
438  YamlObject.Size = MFI.getObjectSize(I);
439  YamlObject.Alignment = MFI.getObjectAlign(I);
440  YamlObject.StackID = (TargetStackID::Value)MFI.getStackID(I);
441 
442  // Save the ID' position in StackObjects storage vector.
443  StackObjectsIdx[ID] = YMF.StackObjects.size();
444  YMF.StackObjects.push_back(YamlObject);
445  StackObjectOperandMapping.insert(std::make_pair(
446  I, FrameIndexOperand::create(YamlObject.Name.Value, ID)));
447  }
448 
449  for (const auto &CSInfo : MFI.getCalleeSavedInfo()) {
450  const int FrameIdx = CSInfo.getFrameIdx();
451  if (!CSInfo.isSpilledToReg() && MFI.isDeadObjectIndex(FrameIdx))
452  continue;
453 
455  printRegMIR(CSInfo.getReg(), Reg, TRI);
456  if (!CSInfo.isSpilledToReg()) {
457  assert(FrameIdx >= MFI.getObjectIndexBegin() &&
458  FrameIdx < MFI.getObjectIndexEnd() &&
459  "Invalid stack object index");
460  if (FrameIdx < 0) { // Negative index means fixed objects.
461  auto &Object =
463  [FixedStackObjectsIdx[FrameIdx + MFI.getNumFixedObjects()]];
464  Object.CalleeSavedRegister = Reg;
465  Object.CalleeSavedRestored = CSInfo.isRestored();
466  } else {
467  auto &Object = YMF.StackObjects[StackObjectsIdx[FrameIdx]];
468  Object.CalleeSavedRegister = Reg;
469  Object.CalleeSavedRestored = CSInfo.isRestored();
470  }
471  }
472  }
473  for (unsigned I = 0, E = MFI.getLocalFrameObjectCount(); I < E; ++I) {
474  auto LocalObject = MFI.getLocalFrameObjectMap(I);
475  assert(LocalObject.first >= 0 && "Expected a locally mapped stack object");
476  YMF.StackObjects[StackObjectsIdx[LocalObject.first]].LocalOffset =
477  LocalObject.second;
478  }
479 
480  // Print the stack object references in the frame information class after
481  // converting the stack objects.
482  if (MFI.hasStackProtectorIndex()) {
484  MIPrinter(StrOS, MST, RegisterMaskIds, StackObjectOperandMapping)
486  }
487 
488  // Print the debug variable information.
489  for (const MachineFunction::VariableDbgInfo &DebugVar :
490  MF.getVariableDbgInfo()) {
491  assert(DebugVar.Slot >= MFI.getObjectIndexBegin() &&
492  DebugVar.Slot < MFI.getObjectIndexEnd() &&
493  "Invalid stack object index");
494  if (DebugVar.Slot < 0) { // Negative index means fixed objects.
495  auto &Object =
496  YMF.FixedStackObjects[FixedStackObjectsIdx[DebugVar.Slot +
497  MFI.getNumFixedObjects()]];
498  printStackObjectDbgInfo(DebugVar, Object, MST);
499  } else {
500  auto &Object = YMF.StackObjects[StackObjectsIdx[DebugVar.Slot]];
501  printStackObjectDbgInfo(DebugVar, Object, MST);
502  }
503  }
504 }
505 
507  const MachineFunction &MF,
508  ModuleSlotTracker &MST) {
509  const auto *TRI = MF.getSubtarget().getRegisterInfo();
510  for (auto CSInfo : MF.getCallSitesInfo()) {
511  yaml::CallSiteInfo YmlCS;
513 
514  // Prepare instruction position.
515  MachineBasicBlock::const_instr_iterator CallI = CSInfo.first->getIterator();
516  CallLocation.BlockNum = CallI->getParent()->getNumber();
517  // Get call instruction offset from the beginning of block.
518  CallLocation.Offset =
519  std::distance(CallI->getParent()->instr_begin(), CallI);
520  YmlCS.CallLocation = CallLocation;
521  // Construct call arguments and theirs forwarding register info.
522  for (auto ArgReg : CSInfo.second) {
524  YmlArgReg.ArgNo = ArgReg.ArgNo;
525  printRegMIR(ArgReg.Reg, YmlArgReg.Reg, TRI);
526  YmlCS.ArgForwardingRegs.emplace_back(YmlArgReg);
527  }
528  YMF.CallSitesInfo.push_back(YmlCS);
529  }
530 
531  // Sort call info by position of call instructions.
532  llvm::sort(YMF.CallSitesInfo.begin(), YMF.CallSitesInfo.end(),
534  if (A.CallLocation.BlockNum == B.CallLocation.BlockNum)
535  return A.CallLocation.Offset < B.CallLocation.Offset;
536  return A.CallLocation.BlockNum < B.CallLocation.BlockNum;
537  });
538 }
539 
541  const MachineFunction &MF,
544  MST.collectMachineMDNodes(MDList);
545  for (auto &MD : MDList) {
546  std::string NS;
547  raw_string_ostream StrOS(NS);
548  MD.second->print(StrOS, MST, MF.getFunction().getParent());
549  YMF.MachineMetadataNodes.push_back(StrOS.str());
550  }
551 }
552 
555  unsigned ID = 0;
556  for (const MachineConstantPoolEntry &Constant : ConstantPool.getConstants()) {
557  std::string Str;
558  raw_string_ostream StrOS(Str);
559  if (Constant.isMachineConstantPoolEntry()) {
560  Constant.Val.MachineCPVal->print(StrOS);
561  } else {
562  Constant.Val.ConstVal->printAsOperand(StrOS);
563  }
564 
565  yaml::MachineConstantPoolValue YamlConstant;
566  YamlConstant.ID = ID++;
567  YamlConstant.Value = StrOS.str();
568  YamlConstant.Alignment = Constant.getAlign();
569  YamlConstant.IsTargetSpecific = Constant.isMachineConstantPoolEntry();
570 
571  MF.Constants.push_back(YamlConstant);
572  }
573 }
574 
576  yaml::MachineJumpTable &YamlJTI,
577  const MachineJumpTableInfo &JTI) {
578  YamlJTI.Kind = JTI.getEntryKind();
579  unsigned ID = 0;
580  for (const auto &Table : JTI.getJumpTables()) {
581  std::string Str;
583  Entry.ID = ID++;
584  for (const auto *MBB : Table.MBBs) {
585  raw_string_ostream StrOS(Str);
586  StrOS << printMBBReference(*MBB);
587  Entry.Blocks.push_back(StrOS.str());
588  Str.clear();
589  }
590  YamlJTI.Entries.push_back(Entry);
591  }
592 }
593 
594 void MIRPrinter::initRegisterMaskIds(const MachineFunction &MF) {
595  const auto *TRI = MF.getSubtarget().getRegisterInfo();
596  unsigned I = 0;
597  for (const uint32_t *Mask : TRI->getRegMasks())
598  RegisterMaskIds.insert(std::make_pair(Mask, I++));
599 }
600 
603  bool &IsFallthrough) {
605 
606  for (const MachineInstr &MI : MBB) {
607  if (MI.isPHI())
608  continue;
609  for (const MachineOperand &MO : MI.operands()) {
610  if (!MO.isMBB())
611  continue;
612  MachineBasicBlock *Succ = MO.getMBB();
613  auto RP = Seen.insert(Succ);
614  if (RP.second)
615  Result.push_back(Succ);
616  }
617  }
619  IsFallthrough = I == MBB.end() || !I->isBarrier();
620 }
621 
622 bool
623 MIPrinter::canPredictBranchProbabilities(const MachineBasicBlock &MBB) const {
624  if (MBB.succ_size() <= 1)
625  return true;
627  return true;
628 
629  SmallVector<BranchProbability,8> Normalized(MBB.Probs.begin(),
630  MBB.Probs.end());
632  Normalized.end());
633  SmallVector<BranchProbability,8> Equal(Normalized.size());
635 
636  return std::equal(Normalized.begin(), Normalized.end(), Equal.begin());
637 }
638 
639 bool MIPrinter::canPredictSuccessors(const MachineBasicBlock &MBB) const {
641  bool GuessedFallthrough;
642  guessSuccessors(MBB, GuessedSuccs, GuessedFallthrough);
643  if (GuessedFallthrough) {
644  const MachineFunction &MF = *MBB.getParent();
645  MachineFunction::const_iterator NextI = std::next(MBB.getIterator());
646  if (NextI != MF.end()) {
647  MachineBasicBlock *Next = const_cast<MachineBasicBlock*>(&*NextI);
648  if (!is_contained(GuessedSuccs, Next))
649  GuessedSuccs.push_back(Next);
650  }
651  }
652  if (GuessedSuccs.size() != MBB.succ_size())
653  return false;
654  return std::equal(MBB.succ_begin(), MBB.succ_end(), GuessedSuccs.begin());
655 }
656 
658  assert(MBB.getNumber() >= 0 && "Invalid MBB number");
659  MBB.printName(OS,
662  &MST);
663  OS << ":\n";
664 
665  bool HasLineAttributes = false;
666  // Print the successors
667  bool canPredictProbs = canPredictBranchProbabilities(MBB);
668  // Even if the list of successors is empty, if we cannot guess it,
669  // we need to print it to tell the parser that the list is empty.
670  // This is needed, because MI model unreachable as empty blocks
671  // with an empty successor list. If the parser would see that
672  // without the successor list, it would guess the code would
673  // fallthrough.
674  if ((!MBB.succ_empty() && !SimplifyMIR) || !canPredictProbs ||
675  !canPredictSuccessors(MBB)) {
676  OS.indent(2) << "successors: ";
677  for (auto I = MBB.succ_begin(), E = MBB.succ_end(); I != E; ++I) {
678  if (I != MBB.succ_begin())
679  OS << ", ";
680  OS << printMBBReference(**I);
681  if (!SimplifyMIR || !canPredictProbs)
682  OS << '('
683  << format("0x%08" PRIx32, MBB.getSuccProbability(I).getNumerator())
684  << ')';
685  }
686  OS << "\n";
687  HasLineAttributes = true;
688  }
689 
690  // Print the live in registers.
692  if (MRI.tracksLiveness() && !MBB.livein_empty()) {
694  OS.indent(2) << "liveins: ";
695  bool First = true;
696  for (const auto &LI : MBB.liveins()) {
697  if (!First)
698  OS << ", ";
699  First = false;
700  OS << printReg(LI.PhysReg, &TRI);
701  if (!LI.LaneMask.all())
702  OS << ":0x" << PrintLaneMask(LI.LaneMask);
703  }
704  OS << "\n";
705  HasLineAttributes = true;
706  }
707 
708  if (HasLineAttributes)
709  OS << "\n";
710  bool IsInBundle = false;
711  for (auto I = MBB.instr_begin(), E = MBB.instr_end(); I != E; ++I) {
712  const MachineInstr &MI = *I;
713  if (IsInBundle && !MI.isInsideBundle()) {
714  OS.indent(2) << "}\n";
715  IsInBundle = false;
716  }
717  OS.indent(IsInBundle ? 4 : 2);
718  print(MI);
719  if (!IsInBundle && MI.getFlag(MachineInstr::BundledSucc)) {
720  OS << " {";
721  IsInBundle = true;
722  }
723  OS << "\n";
724  }
725  if (IsInBundle)
726  OS.indent(2) << "}\n";
727 }
728 
730  const auto *MF = MI.getMF();
731  const auto &MRI = MF->getRegInfo();
732  const auto &SubTarget = MF->getSubtarget();
733  const auto *TRI = SubTarget.getRegisterInfo();
734  assert(TRI && "Expected target register info");
735  const auto *TII = SubTarget.getInstrInfo();
736  assert(TII && "Expected target instruction info");
737  if (MI.isCFIInstruction())
738  assert(MI.getNumOperands() == 1 && "Expected 1 operand in CFI instruction");
739 
740  SmallBitVector PrintedTypes(8);
741  bool ShouldPrintRegisterTies = MI.hasComplexRegisterTies();
742  unsigned I = 0, E = MI.getNumOperands();
743  for (; I < E && MI.getOperand(I).isReg() && MI.getOperand(I).isDef() &&
744  !MI.getOperand(I).isImplicit();
745  ++I) {
746  if (I)
747  OS << ", ";
748  print(MI, I, TRI, TII, ShouldPrintRegisterTies,
749  MI.getTypeToPrint(I, PrintedTypes, MRI),
750  /*PrintDef=*/false);
751  }
752 
753  if (I)
754  OS << " = ";
755  if (MI.getFlag(MachineInstr::FrameSetup))
756  OS << "frame-setup ";
757  if (MI.getFlag(MachineInstr::FrameDestroy))
758  OS << "frame-destroy ";
759  if (MI.getFlag(MachineInstr::FmNoNans))
760  OS << "nnan ";
761  if (MI.getFlag(MachineInstr::FmNoInfs))
762  OS << "ninf ";
763  if (MI.getFlag(MachineInstr::FmNsz))
764  OS << "nsz ";
765  if (MI.getFlag(MachineInstr::FmArcp))
766  OS << "arcp ";
767  if (MI.getFlag(MachineInstr::FmContract))
768  OS << "contract ";
769  if (MI.getFlag(MachineInstr::FmAfn))
770  OS << "afn ";
771  if (MI.getFlag(MachineInstr::FmReassoc))
772  OS << "reassoc ";
773  if (MI.getFlag(MachineInstr::NoUWrap))
774  OS << "nuw ";
775  if (MI.getFlag(MachineInstr::NoSWrap))
776  OS << "nsw ";
777  if (MI.getFlag(MachineInstr::IsExact))
778  OS << "exact ";
779  if (MI.getFlag(MachineInstr::NoFPExcept))
780  OS << "nofpexcept ";
781  if (MI.getFlag(MachineInstr::NoMerge))
782  OS << "nomerge ";
783 
784  OS << TII->getName(MI.getOpcode());
785  if (I < E)
786  OS << ' ';
787 
788  bool NeedComma = false;
789  for (; I < E; ++I) {
790  if (NeedComma)
791  OS << ", ";
792  print(MI, I, TRI, TII, ShouldPrintRegisterTies,
793  MI.getTypeToPrint(I, PrintedTypes, MRI));
794  NeedComma = true;
795  }
796 
797  // Print any optional symbols attached to this instruction as-if they were
798  // operands.
799  if (MCSymbol *PreInstrSymbol = MI.getPreInstrSymbol()) {
800  if (NeedComma)
801  OS << ',';
802  OS << " pre-instr-symbol ";
803  MachineOperand::printSymbol(OS, *PreInstrSymbol);
804  NeedComma = true;
805  }
806  if (MCSymbol *PostInstrSymbol = MI.getPostInstrSymbol()) {
807  if (NeedComma)
808  OS << ',';
809  OS << " post-instr-symbol ";
810  MachineOperand::printSymbol(OS, *PostInstrSymbol);
811  NeedComma = true;
812  }
813  if (MDNode *HeapAllocMarker = MI.getHeapAllocMarker()) {
814  if (NeedComma)
815  OS << ',';
816  OS << " heap-alloc-marker ";
817  HeapAllocMarker->printAsOperand(OS, MST);
818  NeedComma = true;
819  }
820 
821  if (auto Num = MI.peekDebugInstrNum()) {
822  if (NeedComma)
823  OS << ',';
824  OS << " debug-instr-number " << Num;
825  NeedComma = true;
826  }
827 
828  if (PrintLocations) {
829  if (const DebugLoc &DL = MI.getDebugLoc()) {
830  if (NeedComma)
831  OS << ',';
832  OS << " debug-location ";
833  DL->printAsOperand(OS, MST);
834  }
835  }
836 
837  if (!MI.memoperands_empty()) {
838  OS << " :: ";
839  const LLVMContext &Context = MF->getFunction().getContext();
840  const MachineFrameInfo &MFI = MF->getFrameInfo();
841  bool NeedComma = false;
842  for (const auto *Op : MI.memoperands()) {
843  if (NeedComma)
844  OS << ", ";
845  Op->print(OS, MST, SSNs, Context, &MFI, TII);
846  NeedComma = true;
847  }
848  }
849 }
850 
852  auto ObjectInfo = StackObjectOperandMapping.find(FrameIndex);
853  assert(ObjectInfo != StackObjectOperandMapping.end() &&
854  "Invalid frame index");
855  const FrameIndexOperand &Operand = ObjectInfo->second;
856  MachineOperand::printStackObjectReference(OS, Operand.ID, Operand.IsFixed,
857  Operand.Name);
858 }
859 
860 static std::string formatOperandComment(std::string Comment) {
861  if (Comment.empty())
862  return Comment;
863  return std::string(" /* " + Comment + " */");
864 }
865 
866 void MIPrinter::print(const MachineInstr &MI, unsigned OpIdx,
867  const TargetRegisterInfo *TRI,
868  const TargetInstrInfo *TII,
869  bool ShouldPrintRegisterTies, LLT TypeToPrint,
870  bool PrintDef) {
871  const MachineOperand &Op = MI.getOperand(OpIdx);
872  std::string MOComment = TII->createMIROperandComment(MI, Op, OpIdx, TRI);
873 
874  switch (Op.getType()) {
876  if (MI.isOperandSubregIdx(OpIdx)) {
878  MachineOperand::printSubRegIdx(OS, Op.getImm(), TRI);
879  break;
880  }
899  unsigned TiedOperandIdx = 0;
900  if (ShouldPrintRegisterTies && Op.isReg() && Op.isTied() && !Op.isDef())
901  TiedOperandIdx = Op.getParent()->findTiedOperandIdx(OpIdx);
902  const TargetIntrinsicInfo *TII = MI.getMF()->getTarget().getIntrinsicInfo();
903  Op.print(OS, MST, TypeToPrint, OpIdx, PrintDef, /*IsStandalone=*/false,
904  ShouldPrintRegisterTies, TiedOperandIdx, TRI, TII);
905  OS << formatOperandComment(MOComment);
906  break;
907  }
909  printStackObjectReference(Op.getIndex());
910  break;
912  auto RegMaskInfo = RegisterMaskIds.find(Op.getRegMask());
913  if (RegMaskInfo != RegisterMaskIds.end())
914  OS << StringRef(TRI->getRegMaskNames()[RegMaskInfo->second]).lower();
915  else
916  printCustomRegMask(Op.getRegMask(), OS, TRI);
917  break;
918  }
919  }
920 }
921 
923  ModuleSlotTracker &MST) {
924  if (isa<GlobalValue>(V)) {
925  V.printAsOperand(OS, /*PrintType=*/false, MST);
926  return;
927  }
928  if (isa<Constant>(V)) {
929  // Machine memory operands can load/store to/from constant value pointers.
930  OS << '`';
931  V.printAsOperand(OS, /*PrintType=*/true, MST);
932  OS << '`';
933  return;
934  }
935  OS << "%ir.";
936  if (V.hasName()) {
938  return;
939  }
940  int Slot = MST.getCurrentFunction() ? MST.getLocalSlot(&V) : -1;
942 }
943 
944 void llvm::printMIR(raw_ostream &OS, const Module &M) {
945  yaml::Output Out(OS);
946  Out << const_cast<Module &>(M);
947 }
948 
950  MIRPrinter Printer(OS);
951  Printer.print(MF);
952 }
llvm::MachineFunction::hasWinCFI
bool hasWinCFI() const
Definition: MachineFunction.h:708
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:922
llvm::MachineFrameInfo::isMaxCallFrameSizeComputed
bool isMaxCallFrameSizeComputed() const
Definition: MachineFrameInfo.h:629
llvm::yaml::MachineFunction::RegBankSelected
bool RegBankSelected
Definition: MIRYamlMapping.h:691
llvm::MachineBasicBlock::succ_size
unsigned succ_size() const
Definition: MachineBasicBlock.h:344
llvm::MachineOperand::MO_BlockAddress
@ MO_BlockAddress
Address of a basic block.
Definition: MachineOperand.h:63
llvm::yaml::MachineFrameInfo::OffsetAdjustment
int OffsetAdjustment
Definition: MIRYamlMapping.h:603
llvm::MachineFunctionProperties::hasProperty
bool hasProperty(Property P) const
Definition: MachineFunction.h:165
llvm::yaml::MachineConstantPoolValue::ID
UnsignedValue ID
Definition: MIRYamlMapping.h:522
llvm::yaml::CallSiteInfo::ArgForwardingRegs
std::vector< ArgRegPair > ArgForwardingRegs
Definition: MIRYamlMapping.h:454
MCDwarf.h
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:103
MachineInstr.h
llvm::MachineOperand::MO_Immediate
@ MO_Immediate
Immediate operand.
Definition: MachineOperand.h:53
llvm::ModuleSlotTracker::getLocalSlot
int getLocalSlot(const Value *V)
Return the slot number of the specified local value.
Definition: AsmWriter.cpp:869
llvm::object::Equal
@ Equal
Definition: COFFModuleDefinition.cpp:38
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
Reg
unsigned Reg
Definition: MachineSink.cpp:1566
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:598
TargetFrameLowering.h
llvm::MachineFunction::getVariableDbgInfo
VariableDbgInfoMapTy & getVariableDbgInfo()
Definition: MachineFunction.h:1174
llvm::MachineFrameInfo::getNumFixedObjects
unsigned getNumFixedObjects() const
Return the number of fixed objects.
Definition: MachineFrameInfo.h:396
llvm::MachineRegisterInfo::getVRegName
StringRef getVRegName(Register Reg) const
Definition: MachineRegisterInfo.h:428
llvm::yaml::MachineStackObject::Offset
int64_t Offset
Definition: MIRYamlMapping.h:246
AtomicOrdering.h
llvm::MachineOperand::MO_ShuffleMask
@ MO_ShuffleMask
Other IR Constant for ISel (shuffle masks)
Definition: MachineOperand.h:71
llvm::MachineRegisterInfo
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Definition: MachineRegisterInfo.h:52
llvm::MachineOperand::MO_RegisterLiveOut
@ MO_RegisterLiveOut
Mask of live-out registers.
Definition: MachineOperand.h:65
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:709
llvm::raw_string_ostream
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:625
llvm::MachineOperand::printStackObjectReference
static void printStackObjectReference(raw_ostream &OS, unsigned FrameIndex, bool IsFixed, StringRef Name)
Print a stack object reference.
Definition: MachineOperand.cpp:581
llvm::MachineOperand::printIRSlotNumber
static void printIRSlotNumber(raw_ostream &OS, int Slot)
Print an IRSlotNumber.
Definition: MachineOperand.cpp:604
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:1168
llvm::printLLVMNameWithoutPrefix
void printLLVMNameWithoutPrefix(raw_ostream &OS, StringRef Name)
Print out a name of an LLVM value without any prefixes.
Definition: AsmWriter.cpp:349
llvm::yaml::VirtualRegisterDefinition::PreferredRegister
StringValue PreferredRegister
Definition: MIRYamlMapping.h:191
llvm::MachineFunction::end
iterator end()
Definition: MachineFunction.h:810
llvm::printMBBReference
Printable printMBBReference(const MachineBasicBlock &MBB)
Prints a machine basic block reference.
Definition: MachineBasicBlock.cpp:119
llvm::MachineFrameInfo::getCVBytesOfCalleeSavedRegisters
unsigned getCVBytesOfCalleeSavedRegisters() const
Returns how many bytes of callee-saved registers the target pushed in the prologue.
Definition: MachineFrameInfo.h:636
llvm::yaml::MachineFunction::StackObjects
std::vector< MachineStackObject > StackObjects
Definition: MIRYamlMapping.h:704
llvm::ModuleSlotTracker::getCurrentFunction
const Function * getCurrentFunction() const
Definition: ModuleSlotTracker.h:81
llvm::Value::hasName
bool hasName() const
Definition: Value.h:262
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:688
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:695
llvm::MachineRegisterInfo::getTargetRegisterInfo
const TargetRegisterInfo * getTargetRegisterInfo() const
Definition: MachineRegisterInfo.h:153
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:562
llvm::MIRPrinter::convert
void convert(yaml::MachineFunction &MF, const MachineRegisterInfo &RegInfo, const TargetRegisterInfo *TRI)
Definition: MIRPrinter.cpp:306
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:124
MachineModuleSlotTracker.h
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:143
llvm::MIRPrinter::convertStackObjects
void convertStackObjects(yaml::MachineFunction &YMF, const MachineFunction &MF, ModuleSlotTracker &MST)
Definition: MIRPrinter.cpp:378
llvm::TargetRegisterInfo
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Definition: TargetRegisterInfo.h:233
llvm::Function::getContext
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function.
Definition: Function.cpp:321
MachineJumpTableInfo.h
DenseMap.h
Module.h
llvm::MachineBasicBlock::liveins
iterator_range< livein_iterator > liveins() const
Definition: MachineBasicBlock.h:412
llvm::yaml::CallSiteInfo::MachineInstrLoc::Offset
unsigned Offset
Definition: MIRYamlMapping.h:446
llvm::yaml::MachineFunction::Alignment
MaybeAlign Alignment
Definition: MIRYamlMapping.h:687
TargetInstrInfo.h
llvm::MachineInstr::FmAfn
@ FmAfn
Definition: MachineInstr.h:98
llvm::MachineOperand::MO_CFIIndex
@ MO_CFIIndex
MCCFIInstruction index.
Definition: MachineOperand.h:68
llvm::MachineRegisterInfo::getNumVirtRegs
unsigned getNumVirtRegs() const
getNumVirtRegs - Return the number of virtual registers created.
Definition: MachineRegisterInfo.h:757
llvm::SmallPtrSet
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
Definition: SmallPtrSet.h:449
llvm::yaml::FixedMachineStackObject::SpillSlot
@ SpillSlot
Definition: MIRYamlMapping.h:309
printRegMIR
static void printRegMIR(unsigned Reg, yaml::StringValue &Dest, const TargetRegisterInfo *TRI)
Definition: MIRPrinter.cpp:197
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:855
STLExtras.h
llvm::MachineFrameInfo::getObjectIndexEnd
int getObjectIndexEnd() const
Return one past the maximum frame object index.
Definition: MachineFrameInfo.h:393
llvm::yaml::CallSiteInfo
Serializable representation of CallSiteInfo.
Definition: MIRYamlMapping.h:431
Format.h
llvm::BitmaskEnumDetail::Mask
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
llvm::ModuleSlotTracker
Manage lifetime of a slot tracker for printing IR.
Definition: ModuleSlotTracker.h:44
TRI
unsigned const TargetRegisterInfo * TRI
Definition: MachineSink.cpp:1567
llvm::yaml::MachineFrameInfo::CVBytesOfCalleeSavedRegisters
unsigned CVBytesOfCalleeSavedRegisters
Definition: MIRYamlMapping.h:610
llvm::yaml::MachineFunction::Name
StringRef Name
Definition: MIRYamlMapping.h:686
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:622
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:52
llvm::yaml::MachineStackObject::VariableSized
@ VariableSized
Definition: MIRYamlMapping.h:241
MachineRegisterInfo.h
llvm::MachineInstr::FrameDestroy
@ FrameDestroy
Definition: MachineInstr.h:84
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:577
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:197
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:478
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:34
llvm::MachineOperand::printSubRegIdx
static void printSubRegIdx(raw_ostream &OS, uint64_t Index, const TargetRegisterInfo *TRI)
Print a subreg index operand.
Definition: MachineOperand.cpp:516
CommandLine.h
Printer
print alias Alias Set Printer
Definition: AliasSetTracker.cpp:762
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:114
llvm::MachineFunction::getRegInfo
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Definition: MachineFunction.h:636
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:97
GlobalValue.h
llvm::MachineFunctionProperties::Property::Selected
@ Selected
TargetMachine.h
llvm::yaml::FixedMachineStackObject::Alignment
MaybeAlign Alignment
Definition: MIRYamlMapping.h:314
Constants.h
llvm::yaml::MachineStackObject::DefaultType
@ DefaultType
Definition: MIRYamlMapping.h:241
llvm::MIRPrinter::print
void print(const MachineFunction &MF)
Definition: MIRPrinter.cpp:203
llvm::MachineOperand::MO_GlobalAddress
@ MO_GlobalAddress
Address of a global value.
Definition: MachineOperand.h:62
llvm::AArch64::RP
@ RP
Definition: AArch64ISelLowering.h:471
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:374
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::MachineBasicBlock::succ_end
succ_iterator succ_end()
Definition: MachineBasicBlock.h:334
Intrinsics.h
llvm::MIPrinter::MIPrinter
MIPrinter(raw_ostream &OS, ModuleSlotTracker &MST, const DenseMap< const uint32_t *, unsigned > &RegisterMaskIds, const DenseMap< int, FrameIndexOperand > &StackObjectOperandMapping)
Definition: MIRPrinter.cpp:161
llvm::MachineRegisterInfo::isUpdatedCSRsInitialized
bool isUpdatedCSRsInitialized() const
Returns true if the updated CSR list was initialized and false otherwise.
Definition: MachineRegisterInfo.h:230
llvm::yaml::CallSiteInfo::CallLocation
MachineInstrLoc CallLocation
Definition: MIRYamlMapping.h:453
Twine.h
llvm::yaml::MachineFunction::MachineFuncInfo
std::unique_ptr< MachineFunctionInfo > MachineFuncInfo
Constant pool.
Definition: MIRYamlMapping.h:706
InstrTypes.h
MCContext.h
llvm::MachineOperand::MO_FrameIndex
@ MO_FrameIndex
Abstract Stack Frame Index.
Definition: MachineOperand.h:57
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:601
MCSymbol.h
llvm::yaml::BlockScalarTraits< Module >::input
static StringRef input(StringRef Str, void *Ctxt, Module &Mod)
Definition: MIRPrinter.cpp:188
llvm::MachineFunction::getProperties
const MachineFunctionProperties & getProperties() const
Get the function properties.
Definition: MachineFunction.h:717
llvm::MachineInstr::FmNoInfs
@ FmNoInfs
Definition: MachineInstr.h:90
PseudoSourceValue.h
TII
const HexagonInstrInfo * TII
Definition: HexagonCopyToCombine.cpp:129
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:49
llvm::MIPrinter::printStackObjectReference
void printStackObjectReference(int FrameIndex)
Definition: MIRPrinter.cpp:851
llvm::MachineInstr::FrameSetup
@ FrameSetup
Definition: MachineInstr.h:82
llvm::yaml::FixedMachineStackObject::StackID
TargetStackID::Value StackID
Definition: MIRYamlMapping.h:315
IRPrintingPasses.h
llvm::MachineFrameInfo::getRestorePoint
MachineBasicBlock * getRestorePoint() const
Definition: MachineFrameInfo.h:774
llvm::MachineFrameInfo::getStackID
uint8_t getStackID(int ObjectIdx) const
Definition: MachineFrameInfo.h:699
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
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:662
llvm::yaml::MachineFunction::CalleeSavedRegisters
Optional< std::vector< FlowStringValue > > CalleeSavedRegisters
Definition: MIRYamlMapping.h:699
llvm::yaml::MachineFrameInfo::HasVAStart
bool HasVAStart
Definition: MIRYamlMapping.h:612
llvm::raw_ostream::flush
void flush()
Definition: raw_ostream.h:186
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:292
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:553
DebugLoc.h
llvm::MachineFrameInfo::hasMustTailInVarArgFunc
bool hasMustTailInVarArgFunc() const
Returns true if the function is variadic and contains a musttail call.
Definition: MachineFrameInfo.h:602
SmallPtrSet.h
llvm::yaml::MachineFunction::FrameInfo
MachineFrameInfo FrameInfo
Definition: MIRYamlMapping.h:702
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:494
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:104
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:944
llvm::MachineFrameInfo::getObjectIndexBegin
int getObjectIndexBegin() const
Return the minimum frame object index.
Definition: MachineFrameInfo.h:390
llvm::MachineInstr::FmNsz
@ FmNsz
Definition: MachineInstr.h:92
llvm::MachineInstr::NoFPExcept
@ NoFPExcept
Definition: MachineInstr.h:108
BranchProbability.h
llvm::MachineBasicBlock
Definition: MachineBasicBlock.h:95
llvm::MachineFrameInfo::isDeadObjectIndex
bool isDeadObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a dead object.
Definition: MachineFrameInfo.h:713
LowLevelTypeImpl.h
llvm::MachineModuleSlotTracker
Definition: MachineModuleSlotTracker.h:22
llvm::MachineFunction::VariableDbgInfo::Expr
const DIExpression * Expr
Definition: MachineFunction.h:385
llvm::OutputFileType::Object
@ Object
llvm::yaml::FixedMachineStackObject
Serializable representation of the fixed stack object from the MachineFrameInfo class.
Definition: MIRYamlMapping.h:308
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:626
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:408
BasicBlock.h
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:702
llvm::MachineOperand::MO_Metadata
@ MO_Metadata
Metadata reference (for debug info)
Definition: MachineOperand.h:66
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:551
llvm::yaml::FixedMachineStackObject::ID
UnsignedValue ID
Definition: MIRYamlMapping.h:310
llvm::yaml::MachineFunction::Selected
bool Selected
Definition: MIRYamlMapping.h:692
llvm::MachineFrameInfo::getLocalFrameSize
int64_t getLocalFrameSize() const
Get the size of the local object blob.
Definition: MachineFrameInfo.h:421
llvm::MachineInstr
Representation of each machine instruction.
Definition: MachineInstr.h:64
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:453
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:572
llvm::MachineFrameInfo::hasStackProtectorIndex
bool hasStackProtectorIndex() const
Definition: MachineFrameInfo.h:358
llvm::MachineInstr::FmReassoc
@ FmReassoc
Definition: MachineInstr.h:100
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:68
llvm::DenseMap< const uint32_t *, unsigned >
llvm::MachineRegisterInfo::getCalleeSavedRegs
const MCPhysReg * getCalleeSavedRegs() const
Returns list of callee saved registers.
Definition: MachineRegisterInfo.cpp:621
llvm::MachineConstantPool
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
Definition: MachineConstantPool.h:117
DebugInfo.h
llvm::MachineOperand::MO_Predicate
@ MO_Predicate
Generic predicate for ISel.
Definition: MachineOperand.h:70
MIRPrinter.h
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::MachineFunction::getCallSitesInfo
const CallSiteInfoMap & getCallSitesInfo() const
Definition: MachineFunction.h:1189
llvm::MachineFrameInfo::getObjectAlign
Align getObjectAlign(int ObjectIdx) const
Return the alignment of the specified stack object.
Definition: MachineFrameInfo.h:467
llvm::MachineOperand::MO_MCSymbol
@ MO_MCSymbol
MCSymbol reference (for debug/eh info)
Definition: MachineOperand.h:67
llvm::yaml::FixedMachineStackObject::Size
uint64_t Size
Definition: MIRYamlMapping.h:313
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:443
MachineConstantPool.h
llvm::StringRef::lower
LLVM_NODISCARD std::string lower() const
Definition: StringRef.cpp:105
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:1616
llvm::MachineRegisterInfo::liveins
ArrayRef< std::pair< MCRegister, Register > > liveins() const
Definition: MachineRegisterInfo.h:956
llvm::Value::print
void print(raw_ostream &O, bool IsForDebug=false) const
Implement operator<< on Value.
Definition: AsmWriter.cpp:4598
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:267
llvm::MachineFunctionProperties::Property::RegBankSelected
@ RegBankSelected
llvm::yaml::MachineFunctionLiveIn::VirtualRegister
StringValue VirtualRegister
Definition: MIRYamlMapping.h:214
llvm::yaml::MachineFunction
Definition: MIRYamlMapping.h:685
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:541
llvm::yaml::MachineFunction::FixedStackObjects
std::vector< FixedMachineStackObject > FixedStackObjects
Definition: MIRYamlMapping.h:703
llvm::MIPrinter
This class prints out the machine instructions using the MIR serialization format.
Definition: MIRPrinter.cpp:149
llvm::MachineFunction::getConstantPool
MachineConstantPool * getConstantPool()
getConstantPool - Return the constant pool object for the current function.
Definition: MachineFunction.h:658
printCustomRegMask
static void printCustomRegMask(const uint32_t *RegMask, raw_ostream &OS, const TargetRegisterInfo *TRI)
Definition: MIRPrinter.cpp:264
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:79
llvm::MachineBasicBlock::succ_begin
succ_iterator succ_begin()
Definition: MachineBasicBlock.h:332
llvm::MachineFunction::getFrameInfo
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
Definition: MachineFunction.h:642
llvm::MachineBasicBlock::getParent
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
Definition: MachineBasicBlock.h:225
llvm::MachineOperand::MO_TargetIndex
@ MO_TargetIndex
Target-dependent index+offset operand.
Definition: MachineOperand.h:59
llvm::MachineOperand::MO_FPImmediate
@ MO_FPImmediate
Floating-point immediate operand.
Definition: MachineOperand.h:55
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::MDNode
Metadata node.
Definition: Metadata.h:906
llvm::MachineBasicBlock::instr_begin
instr_iterator instr_begin()
Definition: MachineBasicBlock.h:252
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:4675
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:4515
llvm::MachineBasicBlock::instr_end
instr_iterator instr_end()
Definition: MachineBasicBlock.h:254
llvm::MachineFunction
Definition: MachineFunction.h:230
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:106
llvm::MachineBasicBlock::succ_empty
bool succ_empty() const
Definition: MachineBasicBlock.h:347
llvm::MachineOperand::MO_JumpTableIndex
@ MO_JumpTableIndex
Address of indexed Jump Table for switch.
Definition: MachineOperand.h:60
llvm::MachineBasicBlock::PrintNameIr
@ PrintNameIr
Add IR name where available.
Definition: MachineBasicBlock.h:1044
llvm::MachineFrameInfo::getCalleeSavedInfo
const std::vector< CalleeSavedInfo > & getCalleeSavedInfo() const
Returns a reference to call saved info vector for the current function.
Definition: MachineFrameInfo.h:755
llvm::MachineOperand::MO_CImmediate
@ MO_CImmediate
Immediate >64bit operand.
Definition: MachineOperand.h:54
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:174
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:690
None.h
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:386
llvm::MachineBasicBlock::getNumber
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
Definition: MachineBasicBlock.h:1056
llvm::yaml::BlockScalarTraits< Module >::output
static void output(const Module &Mod, void *Ctxt, raw_ostream &OS)
Definition: MIRPrinter.cpp:184
llvm::MachineBasicBlock::PrintNameAttributes
@ PrintNameAttributes
Print attributes.
Definition: MachineBasicBlock.h:1045
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::yaml::MachineJumpTable::Kind
MachineJumpTableInfo::JTEntryKind Kind
Definition: MIRYamlMapping.h:553
llvm::MachineFunction::VariableDbgInfo::Loc
const DILocation * Loc
Definition: MachineFunction.h:388
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:136
llvm::yaml::MachineFunction::FailedISel
bool FailedISel
Definition: MIRYamlMapping.h:693
uint32_t
llvm::MachineOperand::MO_MachineBasicBlock
@ MO_MachineBasicBlock
MachineBasicBlock reference.
Definition: MachineOperand.h:56
llvm::MachineInstr::NoMerge
@ NoMerge
Definition: MachineInstr.h:110
llvm::ilist_node_impl::getIterator
self_iterator getIterator()
Definition: ilist_node.h:81
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:69
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::MIPrinter::print
void print(const MachineBasicBlock &MBB)
Definition: MIRPrinter.cpp:657
LLVM_FALLTHROUGH
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
Definition: Compiler.h:273
llvm::Value::getName
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:309
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:415
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:569
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:368
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:581
llvm::yaml::MachineFunction::DebugValueSubstitutions
std::vector< DebugValueSubstitution > DebugValueSubstitutions
Definition: MIRYamlMapping.h:708
llvm::MIRPrinter::convertMachineMetadataNodes
void convertMachineMetadataNodes(yaml::MachineFunction &YMF, const MachineFunction &MF, MachineModuleSlotTracker &MST)
Definition: MIRPrinter.cpp:540
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:697
llvm::yaml::MachineFunction::ExposesReturnsTwice
bool ExposesReturnsTwice
Definition: MIRYamlMapping.h:688
llvm::MachineFunctionProperties::Property::FailedISel
@ FailedISel
llvm::MachineOperand::printTargetFlags
static void printTargetFlags(raw_ostream &OS, const MachineOperand &Op)
Print operand target flags.
Definition: MachineOperand.cpp:525
llvm::MachineFrameInfo::getSavePoint
MachineBasicBlock * getSavePoint() const
Definition: MachineFrameInfo.h:772
formatOperandComment
static std::string formatOperandComment(std::string Comment)
Definition: MIRPrinter.cpp:860
llvm::MachineRegisterInfo::getSimpleHint
Register getSimpleHint(Register VReg) const
getSimpleHint - same as getRegAllocationHint except it will only return a target independent hint.
Definition: MachineRegisterInfo.h:805
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:52
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:592
uint16_t
llvm::MachineFunction::getTarget
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
Definition: MachineFunction.h:622
llvm::MIRPrinter::MIRPrinter
MIRPrinter(raw_ostream &OS)
Definition: MIRPrinter.cpp:122
llvm::DenseMapBase::end
iterator end()
Definition: DenseMap.h:83
llvm::AMDGPU::SendMsg::Op
Op
Definition: SIDefines.h:321
llvm::MachineFrameInfo::isVariableSizedObjectIndex
bool isVariableSizedObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a variable sized object.
Definition: MachineFrameInfo.h:721
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:61
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::sort
void sort(IteratorTy Start, IteratorTy End)
Definition: STLExtras.h:1492
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
llvm::yaml::MachineStackObject::Size
uint64_t Size
Definition: MIRYamlMapping.h:247
llvm::MachineInstr::FmNoNans
@ FmNoNans
Definition: MachineInstr.h:88
llvm::MachineInstr::FmContract
@ FmContract
Definition: MachineInstr.h:96
llvm::MachineFrameInfo::isSpillSlotObjectIndex
bool isSpillSlotObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a spill slot.
Definition: MachineFrameInfo.h:686
llvm::MachineBasicBlock::livein_empty
bool livein_empty() const
Definition: MachineBasicBlock.h:411
llvm::yaml::MachineConstantPoolValue::Alignment
MaybeAlign Alignment
Definition: MIRYamlMapping.h:524
llvm::yaml::MachineFunction::LiveIns
std::vector< MachineFunctionLiveIn > LiveIns
Definition: MIRYamlMapping.h:698
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:669
llvm::yaml::MachineFunction::HasWinCFI
bool HasWinCFI
Definition: MIRYamlMapping.h:696
llvm::MachineFrameInfo
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
Definition: MachineFrameInfo.h:107
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:711
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:102
llvm::raw_ostream::indent
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
Definition: raw_ostream.cpp:497
RegisterBank.h
TargetIntrinsicInfo.h
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:484
llvm::MachineInstr::BundledSucc
@ BundledSucc
Definition: MachineInstr.h:87
LaneBitmask.h
llvm::yaml::MachineFunction::MachineMetadataNodes
std::vector< StringValue > MachineMetadataNodes
Definition: MIRYamlMapping.h:710
llvm::yaml::MachineConstantPoolValue
Definition: MIRYamlMapping.h:521
llvm::MachineInstr::FmArcp
@ FmArcp
Definition: MachineInstr.h:94
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:43
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:585
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:384
llvm::MachineFrameInfo::getStackProtectorIndex
int getStackProtectorIndex() const
Return the index for the stack protector object.
Definition: MachineFrameInfo.h:356
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:380
llvm::MachineFunction::getJumpTableInfo
const MachineJumpTableInfo * getJumpTableInfo() const
getJumpTableInfo - Return the jump table info object for the current function.
Definition: MachineFunction.h:649
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:577
llvm::MachineOperand::MO_RegisterMask
@ MO_RegisterMask
Mask of preserved registers.
Definition: MachineOperand.h:64
llvm::MachineFrameInfo::hasTailCall
bool hasTailCall() const
Returns true if the function contains a tail call.
Definition: MachineFrameInfo.h:606
llvm::cl::desc
Definition: CommandLine.h:414
Mod
Module * Mod
Definition: PassBuilderBindings.cpp:54
llvm::MachineJumpTableInfo
Definition: MachineJumpTableInfo.h:42
raw_ostream.h
llvm::MachineFunction::VariableDbgInfo
Definition: MachineFunction.h:383
llvm::yaml::MachineFunction::CallSitesInfo
std::vector< CallSiteInfo > CallSitesInfo
Definition: MIRYamlMapping.h:707
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:110
llvm::SmallVectorImpl::reserve
void reserve(size_type N)
Definition: SmallVector.h:624
llvm::MachineInstrBundleIterator< const MachineInstr >
Value.h
llvm::MachineFunction::getAlignment
Align getAlignment() const
getAlignment - Return the alignment of the function.
Definition: MachineFunction.h:674
llvm::raw_string_ostream::str
std::string & str()
Flushes the stream contents to the target string and returns the string's reference.
Definition: raw_ostream.h:643
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
TargetRegisterInfo.h
llvm::MachineModuleSlotTracker::collectMachineMDNodes
void collectMachineMDNodes(MachineMDNodeListType &L) const
Definition: MachineModuleSlotTracker.cpp:60
llvm::MachineBasicBlock::end
iterator end()
Definition: MachineBasicBlock.h:270
llvm::yaml::BlockStringValue::Value
StringValue Value
Definition: MIRYamlMapping.h:81
llvm::MIRPrinter::convertCallSiteObjects
void convertCallSiteObjects(yaml::MachineFunction &YMF, const MachineFunction &MF, ModuleSlotTracker &MST)
Definition: MIRPrinter.cpp:506
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:705
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:364
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:37
llvm::MachineFunctionProperties::Property::Legalized
@ Legalized
llvm::MachineOperand::MO_ConstantPoolIndex
@ MO_ConstantPoolIndex
Address of indexed Constant in Constant Pool.
Definition: MachineOperand.h:58
llvm::MachineFrameInfo::getObjectAllocation
const AllocaInst * getObjectAllocation(int ObjectIdx) const
Return the underlying Alloca of the specified stack object if it exists.
Definition: MachineFrameInfo.h:486
llvm::LLT
Definition: LowLevelTypeImpl.h:40
llvm::yaml::MachineStackObject::Name
StringValue Name
Definition: MIRYamlMapping.h:243