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(
222 
223  convert(YamlMF, MF.getRegInfo(), MF.getSubtarget().getRegisterInfo());
224  MachineModuleSlotTracker MST(&MF);
226  convert(MST, YamlMF.FrameInfo, MF.getFrameInfo());
227  convertStackObjects(YamlMF, MF, MST);
228  convertCallSiteObjects(YamlMF, MF, MST);
229  for (const auto &Sub : MF.DebugValueSubstitutions) {
230  const auto &SubSrc = Sub.Src;
231  const auto &SubDest = Sub.Dest;
232  YamlMF.DebugValueSubstitutions.push_back({SubSrc.first, SubSrc.second,
233  SubDest.first,
234  SubDest.second,
235  Sub.Subreg});
236  }
237  if (const auto *ConstantPool = MF.getConstantPool())
238  convert(YamlMF, *ConstantPool);
239  if (const auto *JumpTableInfo = MF.getJumpTableInfo())
240  convert(MST, YamlMF.JumpTableInfo, *JumpTableInfo);
241 
242  const TargetMachine &TM = MF.getTarget();
243  YamlMF.MachineFuncInfo =
244  std::unique_ptr<yaml::MachineFunctionInfo>(TM.convertFuncInfoToYAML(MF));
245 
246  raw_string_ostream StrOS(YamlMF.Body.Value.Value);
247  bool IsNewlineNeeded = false;
248  for (const auto &MBB : MF) {
249  if (IsNewlineNeeded)
250  StrOS << "\n";
251  MIPrinter(StrOS, MST, RegisterMaskIds, StackObjectOperandMapping)
252  .print(MBB);
253  IsNewlineNeeded = true;
254  }
255  StrOS.flush();
256  // Convert machine metadata collected during the print of the machine
257  // function.
258  convertMachineMetadataNodes(YamlMF, MF, MST);
259 
260  yaml::Output Out(OS);
261  if (!SimplifyMIR)
262  Out.setWriteDefaultValues(true);
263  Out << YamlMF;
264 }
265 
266 static void printCustomRegMask(const uint32_t *RegMask, raw_ostream &OS,
267  const TargetRegisterInfo *TRI) {
268  assert(RegMask && "Can't print an empty register mask");
269  OS << StringRef("CustomRegMask(");
270 
271  bool IsRegInRegMaskFound = false;
272  for (int I = 0, E = TRI->getNumRegs(); I < E; I++) {
273  // Check whether the register is asserted in regmask.
274  if (RegMask[I / 32] & (1u << (I % 32))) {
275  if (IsRegInRegMaskFound)
276  OS << ',';
277  OS << printReg(I, TRI);
278  IsRegInRegMaskFound = true;
279  }
280  }
281 
282  OS << ')';
283 }
284 
285 static void printRegClassOrBank(unsigned Reg, yaml::StringValue &Dest,
286  const MachineRegisterInfo &RegInfo,
287  const TargetRegisterInfo *TRI) {
288  raw_string_ostream OS(Dest.Value);
289  OS << printRegClassOrBank(Reg, RegInfo, TRI);
290 }
291 
292 template <typename T>
293 static void
295  T &Object, ModuleSlotTracker &MST) {
296  std::array<std::string *, 3> Outputs{{&Object.DebugVar.Value,
297  &Object.DebugExpr.Value,
298  &Object.DebugLoc.Value}};
299  std::array<const Metadata *, 3> Metas{{DebugVar.Var,
300  DebugVar.Expr,
301  DebugVar.Loc}};
302  for (unsigned i = 0; i < 3; ++i) {
303  raw_string_ostream StrOS(*Outputs[i]);
304  Metas[i]->printAsOperand(StrOS, MST);
305  }
306 }
307 
309  const MachineRegisterInfo &RegInfo,
310  const TargetRegisterInfo *TRI) {
311  MF.TracksRegLiveness = RegInfo.tracksLiveness();
312 
313  // Print the virtual register definitions.
314  for (unsigned I = 0, E = RegInfo.getNumVirtRegs(); I < E; ++I) {
315  unsigned Reg = Register::index2VirtReg(I);
317  VReg.ID = I;
318  if (RegInfo.getVRegName(Reg) != "")
319  continue;
320  ::printRegClassOrBank(Reg, VReg.Class, RegInfo, TRI);
321  unsigned PreferredReg = RegInfo.getSimpleHint(Reg);
322  if (PreferredReg)
323  printRegMIR(PreferredReg, VReg.PreferredRegister, TRI);
324  MF.VirtualRegisters.push_back(VReg);
325  }
326 
327  // Print the live ins.
328  for (std::pair<unsigned, unsigned> LI : RegInfo.liveins()) {
330  printRegMIR(LI.first, LiveIn.Register, TRI);
331  if (LI.second)
332  printRegMIR(LI.second, LiveIn.VirtualRegister, TRI);
333  MF.LiveIns.push_back(LiveIn);
334  }
335 
336  // Prints the callee saved registers.
337  if (RegInfo.isUpdatedCSRsInitialized()) {
338  const MCPhysReg *CalleeSavedRegs = RegInfo.getCalleeSavedRegs();
339  std::vector<yaml::FlowStringValue> CalleeSavedRegisters;
340  for (const MCPhysReg *I = CalleeSavedRegs; *I; ++I) {
342  printRegMIR(*I, Reg, TRI);
343  CalleeSavedRegisters.push_back(Reg);
344  }
345  MF.CalleeSavedRegisters = CalleeSavedRegisters;
346  }
347 }
348 
350  yaml::MachineFrameInfo &YamlMFI,
351  const MachineFrameInfo &MFI) {
354  YamlMFI.HasStackMap = MFI.hasStackMap();
355  YamlMFI.HasPatchPoint = MFI.hasPatchPoint();
356  YamlMFI.StackSize = MFI.getStackSize();
357  YamlMFI.OffsetAdjustment = MFI.getOffsetAdjustment();
358  YamlMFI.MaxAlignment = MFI.getMaxAlign().value();
359  YamlMFI.AdjustsStack = MFI.adjustsStack();
360  YamlMFI.HasCalls = MFI.hasCalls();
362  ? MFI.getMaxCallFrameSize() : ~0u;
366  YamlMFI.HasVAStart = MFI.hasVAStart();
368  YamlMFI.HasTailCall = MFI.hasTailCall();
369  YamlMFI.LocalFrameSize = MFI.getLocalFrameSize();
370  if (MFI.getSavePoint()) {
371  raw_string_ostream StrOS(YamlMFI.SavePoint.Value);
372  StrOS << printMBBReference(*MFI.getSavePoint());
373  }
374  if (MFI.getRestorePoint()) {
375  raw_string_ostream StrOS(YamlMFI.RestorePoint.Value);
376  StrOS << printMBBReference(*MFI.getRestorePoint());
377  }
378 }
379 
381  const MachineFunction &MF,
382  ModuleSlotTracker &MST) {
383  const MachineFrameInfo &MFI = MF.getFrameInfo();
385 
386  // Process fixed stack objects.
387  assert(YMF.FixedStackObjects.empty());
388  SmallVector<int, 32> FixedStackObjectsIdx;
389  const int BeginIdx = MFI.getObjectIndexBegin();
390  if (BeginIdx < 0)
391  FixedStackObjectsIdx.reserve(-BeginIdx);
392 
393  unsigned ID = 0;
394  for (int I = BeginIdx; I < 0; ++I, ++ID) {
395  FixedStackObjectsIdx.push_back(-1); // Fill index for possible dead.
396  if (MFI.isDeadObjectIndex(I))
397  continue;
398 
400  YamlObject.ID = ID;
401  YamlObject.Type = MFI.isSpillSlotObjectIndex(I)
404  YamlObject.Offset = MFI.getObjectOffset(I);
405  YamlObject.Size = MFI.getObjectSize(I);
406  YamlObject.Alignment = MFI.getObjectAlign(I);
407  YamlObject.StackID = (TargetStackID::Value)MFI.getStackID(I);
408  YamlObject.IsImmutable = MFI.isImmutableObjectIndex(I);
409  YamlObject.IsAliased = MFI.isAliasedObjectIndex(I);
410  // Save the ID' position in FixedStackObjects storage vector.
411  FixedStackObjectsIdx[ID] = YMF.FixedStackObjects.size();
412  YMF.FixedStackObjects.push_back(YamlObject);
413  StackObjectOperandMapping.insert(
414  std::make_pair(I, FrameIndexOperand::createFixed(ID)));
415  }
416 
417  // Process ordinary stack objects.
418  assert(YMF.StackObjects.empty());
419  SmallVector<unsigned, 32> StackObjectsIdx;
420  const int EndIdx = MFI.getObjectIndexEnd();
421  if (EndIdx > 0)
422  StackObjectsIdx.reserve(EndIdx);
423  ID = 0;
424  for (int I = 0; I < EndIdx; ++I, ++ID) {
425  StackObjectsIdx.push_back(-1); // Fill index for possible dead.
426  if (MFI.isDeadObjectIndex(I))
427  continue;
428 
429  yaml::MachineStackObject YamlObject;
430  YamlObject.ID = ID;
431  if (const auto *Alloca = MFI.getObjectAllocation(I))
432  YamlObject.Name.Value = std::string(
433  Alloca->hasName() ? Alloca->getName() : "");
434  YamlObject.Type = MFI.isSpillSlotObjectIndex(I)
439  YamlObject.Offset = MFI.getObjectOffset(I);
440  YamlObject.Size = MFI.getObjectSize(I);
441  YamlObject.Alignment = MFI.getObjectAlign(I);
442  YamlObject.StackID = (TargetStackID::Value)MFI.getStackID(I);
443 
444  // Save the ID' position in StackObjects storage vector.
445  StackObjectsIdx[ID] = YMF.StackObjects.size();
446  YMF.StackObjects.push_back(YamlObject);
447  StackObjectOperandMapping.insert(std::make_pair(
448  I, FrameIndexOperand::create(YamlObject.Name.Value, ID)));
449  }
450 
451  for (const auto &CSInfo : MFI.getCalleeSavedInfo()) {
452  const int FrameIdx = CSInfo.getFrameIdx();
453  if (!CSInfo.isSpilledToReg() && MFI.isDeadObjectIndex(FrameIdx))
454  continue;
455 
457  printRegMIR(CSInfo.getReg(), Reg, TRI);
458  if (!CSInfo.isSpilledToReg()) {
459  assert(FrameIdx >= MFI.getObjectIndexBegin() &&
460  FrameIdx < MFI.getObjectIndexEnd() &&
461  "Invalid stack object index");
462  if (FrameIdx < 0) { // Negative index means fixed objects.
463  auto &Object =
465  [FixedStackObjectsIdx[FrameIdx + MFI.getNumFixedObjects()]];
466  Object.CalleeSavedRegister = Reg;
467  Object.CalleeSavedRestored = CSInfo.isRestored();
468  } else {
469  auto &Object = YMF.StackObjects[StackObjectsIdx[FrameIdx]];
470  Object.CalleeSavedRegister = Reg;
471  Object.CalleeSavedRestored = CSInfo.isRestored();
472  }
473  }
474  }
475  for (unsigned I = 0, E = MFI.getLocalFrameObjectCount(); I < E; ++I) {
476  auto LocalObject = MFI.getLocalFrameObjectMap(I);
477  assert(LocalObject.first >= 0 && "Expected a locally mapped stack object");
478  YMF.StackObjects[StackObjectsIdx[LocalObject.first]].LocalOffset =
479  LocalObject.second;
480  }
481 
482  // Print the stack object references in the frame information class after
483  // converting the stack objects.
484  if (MFI.hasStackProtectorIndex()) {
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 (MRI.tracksLiveness() && !MBB.livein_empty()) {
696  OS.indent(2) << "liveins: ";
697  bool First = true;
698  for (const auto &LI : MBB.liveins()) {
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 
823  if (auto Num = MI.peekDebugInstrNum()) {
824  if (NeedComma)
825  OS << ',';
826  OS << " debug-instr-number " << Num;
827  NeedComma = true;
828  }
829 
830  if (PrintLocations) {
831  if (const DebugLoc &DL = MI.getDebugLoc()) {
832  if (NeedComma)
833  OS << ',';
834  OS << " debug-location ";
835  DL->printAsOperand(OS, MST);
836  }
837  }
838 
839  if (!MI.memoperands_empty()) {
840  OS << " :: ";
841  const LLVMContext &Context = MF->getFunction().getContext();
842  const MachineFrameInfo &MFI = MF->getFrameInfo();
843  bool NeedComma = false;
844  for (const auto *Op : MI.memoperands()) {
845  if (NeedComma)
846  OS << ", ";
847  Op->print(OS, MST, SSNs, Context, &MFI, TII);
848  NeedComma = true;
849  }
850  }
851 }
852 
854  auto ObjectInfo = StackObjectOperandMapping.find(FrameIndex);
855  assert(ObjectInfo != StackObjectOperandMapping.end() &&
856  "Invalid frame index");
857  const FrameIndexOperand &Operand = ObjectInfo->second;
858  MachineOperand::printStackObjectReference(OS, Operand.ID, Operand.IsFixed,
859  Operand.Name);
860 }
861 
862 static std::string formatOperandComment(std::string Comment) {
863  if (Comment.empty())
864  return Comment;
865  return std::string(" /* " + Comment + " */");
866 }
867 
868 void MIPrinter::print(const MachineInstr &MI, unsigned OpIdx,
869  const TargetRegisterInfo *TRI,
870  const TargetInstrInfo *TII,
871  bool ShouldPrintRegisterTies, LLT TypeToPrint,
872  bool PrintDef) {
873  const MachineOperand &Op = MI.getOperand(OpIdx);
874  std::string MOComment = TII->createMIROperandComment(MI, Op, OpIdx, TRI);
875 
876  switch (Op.getType()) {
878  if (MI.isOperandSubregIdx(OpIdx)) {
880  MachineOperand::printSubRegIdx(OS, Op.getImm(), TRI);
881  break;
882  }
901  unsigned TiedOperandIdx = 0;
902  if (ShouldPrintRegisterTies && Op.isReg() && Op.isTied() && !Op.isDef())
903  TiedOperandIdx = Op.getParent()->findTiedOperandIdx(OpIdx);
904  const TargetIntrinsicInfo *TII = MI.getMF()->getTarget().getIntrinsicInfo();
905  Op.print(OS, MST, TypeToPrint, OpIdx, PrintDef, /*IsStandalone=*/false,
906  ShouldPrintRegisterTies, TiedOperandIdx, TRI, TII);
907  OS << formatOperandComment(MOComment);
908  break;
909  }
911  printStackObjectReference(Op.getIndex());
912  break;
914  auto RegMaskInfo = RegisterMaskIds.find(Op.getRegMask());
915  if (RegMaskInfo != RegisterMaskIds.end())
916  OS << StringRef(TRI->getRegMaskNames()[RegMaskInfo->second]).lower();
917  else
918  printCustomRegMask(Op.getRegMask(), OS, TRI);
919  break;
920  }
921  }
922 }
923 
925  ModuleSlotTracker &MST) {
926  if (isa<GlobalValue>(V)) {
927  V.printAsOperand(OS, /*PrintType=*/false, MST);
928  return;
929  }
930  if (isa<Constant>(V)) {
931  // Machine memory operands can load/store to/from constant value pointers.
932  OS << '`';
933  V.printAsOperand(OS, /*PrintType=*/true, MST);
934  OS << '`';
935  return;
936  }
937  OS << "%ir.";
938  if (V.hasName()) {
940  return;
941  }
942  int Slot = MST.getCurrentFunction() ? MST.getLocalSlot(&V) : -1;
944 }
945 
946 void llvm::printMIR(raw_ostream &OS, const Module &M) {
947  yaml::Output Out(OS);
948  Out << const_cast<Module &>(M);
949 }
950 
952  MIRPrinter Printer(OS);
953  Printer.print(MF);
954 }
llvm::MachineFunction::hasWinCFI
bool hasWinCFI() const
Definition: MachineFunction.h:716
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:924
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:169
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:105
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:865
llvm::object::Equal
@ Equal
Definition: COFFModuleDefinition.cpp:38
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
Reg
unsigned Reg
Definition: MachineSink.cpp:1558
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:1183
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
T
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:710
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:586
llvm::MachineOperand::printIRSlotNumber
static void printIRSlotNumber(raw_ostream &OS, int Slot)
Print an IRSlotNumber.
Definition: MachineOperand.cpp:609
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:350
llvm::yaml::VirtualRegisterDefinition::PreferredRegister
StringValue PreferredRegister
Definition: MIRYamlMapping.h:191
llvm::MachineFunction::end
iterator end()
Definition: MachineFunction.h:818
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:705
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:696
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:308
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:380
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:851
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:1559
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
Context
ManagedStatic< detail::RecordContext > Context
Definition: Record.cpp:96
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:582
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
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:477
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:521
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:644
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: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: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:707
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:603
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:725
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:853
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:700
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:294
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:703
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:946
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:389
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::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:634
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:555
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:578
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:619
llvm::MachineConstantPool
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
Definition: MachineConstantPool.h:117
DebugInfo.h
llvm::yaml::MachineFunction::FailsVerification
bool FailsVerification
Definition: MIRYamlMapping.h:697
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:1198
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:441
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:1665
llvm::MachineRegisterInfo::liveins
ArrayRef< std::pair< MCRegister, Register > > liveins() const
Definition: MachineRegisterInfo.h:969
llvm::Value::print
void print(raw_ostream &O, bool IsForDebug=false) const
Implement operator<< on Value.
Definition: AsmWriter.cpp:4569
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:266
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:542
llvm::yaml::MachineFunction::FixedStackObjects
std::vector< FixedMachineStackObject > FixedStackObjects
Definition: MIRYamlMapping.h:704
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:666
printCustomRegMask
static void printCustomRegMask(const uint32_t *RegMask, raw_ostream &OS, const TargetRegisterInfo *TRI)
Definition: MIRPrinter.cpp:266
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:80
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:650
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:4652
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:4486
llvm::MachineBasicBlock::instr_end
instr_iterator instr_end()
Definition: MachineBasicBlock.h:254
llvm::MachineFunction
Definition: MachineFunction.h:234
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:57
llvm::yaml::MachineJumpTable::Kind
MachineJumpTableInfo::JTEntryKind Kind
Definition: MIRYamlMapping.h:553
llvm::MachineFunction::VariableDbgInfo::Loc
const DILocation * Loc
Definition: MachineFunction.h:392
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:134
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:659
LLVM_FALLTHROUGH
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
Definition: Compiler.h:286
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:709
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:698
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:530
llvm::MachineFrameInfo::getSavePoint
MachineBasicBlock * getSavePoint() const
Definition: MachineFrameInfo.h:772
formatOperandComment
static std::string formatOperandComment(std::string Comment)
Definition: MIRPrinter.cpp:862
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:600
uint16_t
llvm::MachineFunction::getTarget
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
Definition: MachineFunction.h:630
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:325
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:1541
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:699
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:712
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:488
llvm::MachineInstr::BundledSucc
@ BundledSucc
Definition: MachineInstr.h:87
LaneBitmask.h
llvm::yaml::MachineFunction::MachineMetadataNodes
std::vector< StringValue > MachineMetadataNodes
Definition: MIRYamlMapping.h:711
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:388
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:657
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:412
Mod
Module * Mod
Definition: PassBuilderBindings.cpp:54
llvm::MachineJumpTableInfo
Definition: MachineJumpTableInfo.h:42
raw_ostream.h
llvm::MachineFunction::VariableDbgInfo
Definition: MachineFunction.h:387
llvm::yaml::MachineFunction::CallSitesInfo
std::vector< CallSiteInfo > CallSitesInfo
Definition: MIRYamlMapping.h:708
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:682
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:74
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: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:706
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:38
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