LLVM  13.0.0git
MachineFunction.cpp
Go to the documentation of this file.
1 //===- MachineFunction.cpp ------------------------------------------------===//
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 // Collect native machine code information for a function. This allows
10 // target-specific information about the generated code to be stored with each
11 // function.
12 //
13 //===----------------------------------------------------------------------===//
14 
16 #include "llvm/ADT/BitVector.h"
17 #include "llvm/ADT/DenseMap.h"
18 #include "llvm/ADT/DenseSet.h"
19 #include "llvm/ADT/STLExtras.h"
20 #include "llvm/ADT/SmallString.h"
21 #include "llvm/ADT/SmallVector.h"
22 #include "llvm/ADT/StringRef.h"
23 #include "llvm/ADT/Twine.h"
42 #include "llvm/Config/llvm-config.h"
43 #include "llvm/IR/Attributes.h"
44 #include "llvm/IR/BasicBlock.h"
45 #include "llvm/IR/Constant.h"
46 #include "llvm/IR/DataLayout.h"
48 #include "llvm/IR/DerivedTypes.h"
49 #include "llvm/IR/Function.h"
50 #include "llvm/IR/GlobalValue.h"
51 #include "llvm/IR/Instruction.h"
52 #include "llvm/IR/Instructions.h"
53 #include "llvm/IR/Metadata.h"
54 #include "llvm/IR/Module.h"
56 #include "llvm/IR/Value.h"
57 #include "llvm/MC/MCContext.h"
58 #include "llvm/MC/MCSymbol.h"
59 #include "llvm/MC/SectionKind.h"
60 #include "llvm/Support/Casting.h"
62 #include "llvm/Support/Compiler.h"
64 #include "llvm/Support/Debug.h"
69 #include <algorithm>
70 #include <cassert>
71 #include <cstddef>
72 #include <cstdint>
73 #include <iterator>
74 #include <string>
75 #include <type_traits>
76 #include <utility>
77 #include <vector>
78 
79 using namespace llvm;
80 
81 #define DEBUG_TYPE "codegen"
82 
84  "align-all-functions",
85  cl::desc("Force the alignment of all functions in log2 format (e.g. 4 "
86  "means align on 16B boundaries)."),
87  cl::init(0), cl::Hidden);
88 
91 
92  switch(Prop) {
93  case P::FailedISel: return "FailedISel";
94  case P::IsSSA: return "IsSSA";
95  case P::Legalized: return "Legalized";
96  case P::NoPHIs: return "NoPHIs";
97  case P::NoVRegs: return "NoVRegs";
98  case P::RegBankSelected: return "RegBankSelected";
99  case P::Selected: return "Selected";
100  case P::TracksLiveness: return "TracksLiveness";
101  case P::TiedOpsRewritten: return "TiedOpsRewritten";
102  }
103  llvm_unreachable("Invalid machine function property");
104 }
105 
106 // Pin the vtable to this file.
107 void MachineFunction::Delegate::anchor() {}
108 
110  const char *Separator = "";
111  for (BitVector::size_type I = 0; I < Properties.size(); ++I) {
112  if (!Properties[I])
113  continue;
114  OS << Separator << getPropertyName(static_cast<Property>(I));
115  Separator = ", ";
116  }
117 }
118 
119 //===----------------------------------------------------------------------===//
120 // MachineFunction implementation
121 //===----------------------------------------------------------------------===//
122 
123 // Out-of-line virtual method.
125 
128 }
129 
130 static inline unsigned getFnStackAlignment(const TargetSubtargetInfo *STI,
131  const Function &F) {
132  if (F.hasFnAttribute(Attribute::StackAlignment))
133  return F.getFnStackAlignment();
134  return STI->getFrameLowering()->getStackAlign().value();
135 }
136 
138  const TargetSubtargetInfo &STI,
139  unsigned FunctionNum, MachineModuleInfo &mmi)
140  : F(F), Target(Target), STI(&STI), Ctx(mmi.getContext()), MMI(mmi) {
141  FunctionNumber = FunctionNum;
142  init();
143 }
144 
145 void MachineFunction::handleInsertion(MachineInstr &MI) {
146  if (TheDelegate)
147  TheDelegate->MF_HandleInsertion(MI);
148 }
149 
150 void MachineFunction::handleRemoval(MachineInstr &MI) {
151  if (TheDelegate)
152  TheDelegate->MF_HandleRemoval(MI);
153 }
154 
155 void MachineFunction::init() {
156  // Assume the function starts in SSA form with correct liveness.
159  if (STI->getRegisterInfo())
160  RegInfo = new (Allocator) MachineRegisterInfo(this);
161  else
162  RegInfo = nullptr;
163 
164  MFInfo = nullptr;
165  // We can realign the stack if the target supports it and the user hasn't
166  // explicitly asked us not to.
167  bool CanRealignSP = STI->getFrameLowering()->isStackRealignable() &&
168  !F.hasFnAttribute("no-realign-stack");
169  FrameInfo = new (Allocator) MachineFrameInfo(
170  getFnStackAlignment(STI, F), /*StackRealignable=*/CanRealignSP,
171  /*ForcedRealign=*/CanRealignSP &&
172  F.hasFnAttribute(Attribute::StackAlignment));
173 
174  if (F.hasFnAttribute(Attribute::StackAlignment))
175  FrameInfo->ensureMaxAlignment(*F.getFnStackAlign());
176 
177  ConstantPool = new (Allocator) MachineConstantPool(getDataLayout());
178  Alignment = STI->getTargetLowering()->getMinFunctionAlignment();
179 
180  // FIXME: Shouldn't use pref alignment if explicit alignment is set on F.
181  // FIXME: Use Function::hasOptSize().
182  if (!F.hasFnAttribute(Attribute::OptimizeForSize))
183  Alignment = std::max(Alignment,
185 
186  if (AlignAllFunctions)
187  Alignment = Align(1ULL << AlignAllFunctions);
188 
189  JumpTableInfo = nullptr;
190 
192  F.hasPersonalityFn() ? F.getPersonalityFn() : nullptr))) {
193  WinEHInfo = new (Allocator) WinEHFuncInfo();
194  }
195 
197  F.hasPersonalityFn() ? F.getPersonalityFn() : nullptr))) {
198  WasmEHInfo = new (Allocator) WasmEHFuncInfo();
199  }
200 
201  assert(Target.isCompatibleDataLayout(getDataLayout()) &&
202  "Can't create a MachineFunction using a Module with a "
203  "Target-incompatible DataLayout attached\n");
204 
205  PSVManager =
206  std::make_unique<PseudoSourceValueManager>(*(getSubtarget().
207  getInstrInfo()));
208 }
209 
211  clear();
212 }
213 
214 void MachineFunction::clear() {
215  Properties.reset();
216  // Don't call destructors on MachineInstr and MachineOperand. All of their
217  // memory comes from the BumpPtrAllocator which is about to be purged.
218  //
219  // Do call MachineBasicBlock destructors, it contains std::vectors.
220  for (iterator I = begin(), E = end(); I != E; I = BasicBlocks.erase(I))
221  I->Insts.clearAndLeakNodesUnsafely();
222  MBBNumbering.clear();
223 
224  InstructionRecycler.clear(Allocator);
225  OperandRecycler.clear(Allocator);
226  BasicBlockRecycler.clear(Allocator);
227  CodeViewAnnotations.clear();
229  if (RegInfo) {
230  RegInfo->~MachineRegisterInfo();
231  Allocator.Deallocate(RegInfo);
232  }
233  if (MFInfo) {
234  MFInfo->~MachineFunctionInfo();
235  Allocator.Deallocate(MFInfo);
236  }
237 
238  FrameInfo->~MachineFrameInfo();
239  Allocator.Deallocate(FrameInfo);
240 
241  ConstantPool->~MachineConstantPool();
242  Allocator.Deallocate(ConstantPool);
243 
244  if (JumpTableInfo) {
245  JumpTableInfo->~MachineJumpTableInfo();
246  Allocator.Deallocate(JumpTableInfo);
247  }
248 
249  if (WinEHInfo) {
250  WinEHInfo->~WinEHFuncInfo();
251  Allocator.Deallocate(WinEHInfo);
252  }
253 
254  if (WasmEHInfo) {
255  WasmEHInfo->~WasmEHFuncInfo();
256  Allocator.Deallocate(WasmEHInfo);
257  }
258 }
259 
261  return F.getParent()->getDataLayout();
262 }
263 
264 /// Get the JumpTableInfo for this function.
265 /// If it does not already exist, allocate one.
267 getOrCreateJumpTableInfo(unsigned EntryKind) {
268  if (JumpTableInfo) return JumpTableInfo;
269 
270  JumpTableInfo = new (Allocator)
272  return JumpTableInfo;
273 }
274 
276  return F.getDenormalMode(FPType);
277 }
278 
279 /// Should we be emitting segmented stack stuff for the function
281  return getFunction().hasFnAttribute("split-stack");
282 }
283 
284 LLVM_NODISCARD unsigned
286  FrameInstructions.push_back(Inst);
287  return FrameInstructions.size() - 1;
288 }
289 
290 /// This discards all of the MachineBasicBlock numbers and recomputes them.
291 /// This guarantees that the MBB numbers are sequential, dense, and match the
292 /// ordering of the blocks within the function. If a specific MachineBasicBlock
293 /// is specified, only that block and those after it are renumbered.
295  if (empty()) { MBBNumbering.clear(); return; }
297  if (MBB == nullptr)
298  MBBI = begin();
299  else
300  MBBI = MBB->getIterator();
301 
302  // Figure out the block number this should have.
303  unsigned BlockNo = 0;
304  if (MBBI != begin())
305  BlockNo = std::prev(MBBI)->getNumber() + 1;
306 
307  for (; MBBI != E; ++MBBI, ++BlockNo) {
308  if (MBBI->getNumber() != (int)BlockNo) {
309  // Remove use of the old number.
310  if (MBBI->getNumber() != -1) {
311  assert(MBBNumbering[MBBI->getNumber()] == &*MBBI &&
312  "MBB number mismatch!");
313  MBBNumbering[MBBI->getNumber()] = nullptr;
314  }
315 
316  // If BlockNo is already taken, set that block's number to -1.
317  if (MBBNumbering[BlockNo])
318  MBBNumbering[BlockNo]->setNumber(-1);
319 
320  MBBNumbering[BlockNo] = &*MBBI;
321  MBBI->setNumber(BlockNo);
322  }
323  }
324 
325  // Okay, all the blocks are renumbered. If we have compactified the block
326  // numbering, shrink MBBNumbering now.
327  assert(BlockNo <= MBBNumbering.size() && "Mismatch!");
328  MBBNumbering.resize(BlockNo);
329 }
330 
331 /// This method iterates over the basic blocks and assigns their IsBeginSection
332 /// and IsEndSection fields. This must be called after MBB layout is finalized
333 /// and the SectionID's are assigned to MBBs.
336  auto CurrentSectionID = front().getSectionID();
337  for (auto MBBI = std::next(begin()), E = end(); MBBI != E; ++MBBI) {
338  if (MBBI->getSectionID() == CurrentSectionID)
339  continue;
341  std::prev(MBBI)->setIsEndSection();
342  CurrentSectionID = MBBI->getSectionID();
343  }
344  back().setIsEndSection();
345 }
346 
347 /// Allocate a new MachineInstr. Use this instead of `new MachineInstr'.
349  const DebugLoc &DL,
350  bool NoImplicit) {
351  return new (InstructionRecycler.Allocate<MachineInstr>(Allocator))
352  MachineInstr(*this, MCID, DL, NoImplicit);
353 }
354 
355 /// Create a new MachineInstr which is a copy of the 'Orig' instruction,
356 /// identical in all ways except the instruction has no parent, prev, or next.
357 MachineInstr *
359  return new (InstructionRecycler.Allocate<MachineInstr>(Allocator))
360  MachineInstr(*this, *Orig);
361 }
362 
364  MachineBasicBlock::iterator InsertBefore, const MachineInstr &Orig) {
365  MachineInstr *FirstClone = nullptr;
367  while (true) {
368  MachineInstr *Cloned = CloneMachineInstr(&*I);
369  MBB.insert(InsertBefore, Cloned);
370  if (FirstClone == nullptr) {
371  FirstClone = Cloned;
372  } else {
373  Cloned->bundleWithPred();
374  }
375 
376  if (!I->isBundledWithSucc())
377  break;
378  ++I;
379  }
380  // Copy over call site info to the cloned instruction if needed. If Orig is in
381  // a bundle, copyCallSiteInfo takes care of finding the call instruction in
382  // the bundle.
383  if (Orig.shouldUpdateCallSiteInfo())
384  copyCallSiteInfo(&Orig, FirstClone);
385  return *FirstClone;
386 }
387 
388 /// Delete the given MachineInstr.
389 ///
390 /// This function also serves as the MachineInstr destructor - the real
391 /// ~MachineInstr() destructor must be empty.
392 void
394  // Verify that a call site info is at valid state. This assertion should
395  // be triggered during the implementation of support for the
396  // call site info of a new architecture. If the assertion is triggered,
397  // back trace will tell where to insert a call to updateCallSiteInfo().
398  assert((!MI->isCandidateForCallSiteEntry() ||
399  CallSitesInfo.find(MI) == CallSitesInfo.end()) &&
400  "Call site info was not updated!");
401  // Strip it for parts. The operand array and the MI object itself are
402  // independently recyclable.
403  if (MI->Operands)
404  deallocateOperandArray(MI->CapOperands, MI->Operands);
405  // Don't call ~MachineInstr() which must be trivial anyway because
406  // ~MachineFunction drops whole lists of MachineInstrs wihout calling their
407  // destructors.
408  InstructionRecycler.Deallocate(Allocator, MI);
409 }
410 
411 /// Allocate a new MachineBasicBlock. Use this instead of
412 /// `new MachineBasicBlock'.
415  return new (BasicBlockRecycler.Allocate<MachineBasicBlock>(Allocator))
416  MachineBasicBlock(*this, bb);
417 }
418 
419 /// Delete the given MachineBasicBlock.
420 void
422  assert(MBB->getParent() == this && "MBB parent mismatch!");
423  // Clean up any references to MBB in jump tables before deleting it.
424  if (JumpTableInfo)
425  JumpTableInfo->RemoveMBBFromJumpTables(MBB);
426  MBB->~MachineBasicBlock();
427  BasicBlockRecycler.Deallocate(Allocator, MBB);
428 }
429 
431  MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, uint64_t s,
432  Align base_alignment, const AAMDNodes &AAInfo, const MDNode *Ranges,
433  SyncScope::ID SSID, AtomicOrdering Ordering,
434  AtomicOrdering FailureOrdering) {
435  return new (Allocator)
436  MachineMemOperand(PtrInfo, f, s, base_alignment, AAInfo, Ranges,
437  SSID, Ordering, FailureOrdering);
438 }
439 
441  const MachineMemOperand *MMO, MachinePointerInfo &PtrInfo, uint64_t Size) {
442  return new (Allocator) MachineMemOperand(
443  PtrInfo, MMO->getFlags(), Size, MMO->getBaseAlign(), AAMDNodes(), nullptr,
444  MMO->getSyncScopeID(), MMO->getOrdering(), MMO->getFailureOrdering());
445 }
446 
449  int64_t Offset, uint64_t Size) {
450  const MachinePointerInfo &PtrInfo = MMO->getPointerInfo();
451 
452  // If there is no pointer value, the offset isn't tracked so we need to adjust
453  // the base alignment.
454  Align Alignment = PtrInfo.V.isNull()
456  : MMO->getBaseAlign();
457 
458  // Do not preserve ranges, since we don't necessarily know what the high bits
459  // are anymore.
460  return new (Allocator)
462  Alignment, MMO->getAAInfo(), nullptr, MMO->getSyncScopeID(),
463  MMO->getOrdering(), MMO->getFailureOrdering());
464 }
465 
468  const AAMDNodes &AAInfo) {
469  MachinePointerInfo MPI = MMO->getValue() ?
470  MachinePointerInfo(MMO->getValue(), MMO->getOffset()) :
472 
473  return new (Allocator) MachineMemOperand(
474  MPI, MMO->getFlags(), MMO->getSize(), MMO->getBaseAlign(), AAInfo,
475  MMO->getRanges(), MMO->getSyncScopeID(), MMO->getOrdering(),
476  MMO->getFailureOrdering());
477 }
478 
481  MachineMemOperand::Flags Flags) {
482  return new (Allocator) MachineMemOperand(
483  MMO->getPointerInfo(), Flags, MMO->getSize(), MMO->getBaseAlign(),
484  MMO->getAAInfo(), MMO->getRanges(), MMO->getSyncScopeID(),
485  MMO->getOrdering(), MMO->getFailureOrdering());
486 }
487 
488 MachineInstr::ExtraInfo *MachineFunction::createMIExtraInfo(
489  ArrayRef<MachineMemOperand *> MMOs, MCSymbol *PreInstrSymbol,
490  MCSymbol *PostInstrSymbol, MDNode *HeapAllocMarker) {
491  return MachineInstr::ExtraInfo::create(Allocator, MMOs, PreInstrSymbol,
492  PostInstrSymbol, HeapAllocMarker);
493 }
494 
496  char *Dest = Allocator.Allocate<char>(Name.size() + 1);
497  llvm::copy(Name, Dest);
498  Dest[Name.size()] = 0;
499  return Dest;
500 }
501 
503  unsigned NumRegs = getSubtarget().getRegisterInfo()->getNumRegs();
504  unsigned Size = MachineOperand::getRegMaskSize(NumRegs);
505  uint32_t *Mask = Allocator.Allocate<uint32_t>(Size);
506  memset(Mask, 0, Size * sizeof(Mask[0]));
507  return Mask;
508 }
509 
511  int* AllocMask = Allocator.Allocate<int>(Mask.size());
512  copy(Mask, AllocMask);
513  return {AllocMask, Mask.size()};
514 }
515 
516 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
518  print(dbgs());
519 }
520 #endif
521 
523  return getFunction().getName();
524 }
525 
526 void MachineFunction::print(raw_ostream &OS, const SlotIndexes *Indexes) const {
527  OS << "# Machine code for function " << getName() << ": ";
528  getProperties().print(OS);
529  OS << '\n';
530 
531  // Print Frame Information
532  FrameInfo->print(*this, OS);
533 
534  // Print JumpTable Information
535  if (JumpTableInfo)
536  JumpTableInfo->print(OS);
537 
538  // Print Constant Pool
539  ConstantPool->print(OS);
540 
542 
543  if (RegInfo && !RegInfo->livein_empty()) {
544  OS << "Function Live Ins: ";
546  I = RegInfo->livein_begin(), E = RegInfo->livein_end(); I != E; ++I) {
547  OS << printReg(I->first, TRI);
548  if (I->second)
549  OS << " in " << printReg(I->second, TRI);
550  if (std::next(I) != E)
551  OS << ", ";
552  }
553  OS << '\n';
554  }
555 
558  for (const auto &BB : *this) {
559  OS << '\n';
560  // If we print the whole function, print it at its most verbose level.
561  BB.print(OS, MST, Indexes, /*IsStandalone=*/true);
562  }
563 
564  OS << "\n# End machine code for function " << getName() << ".\n\n";
565 }
566 
567 /// True if this function needs frame moves for debug or exceptions.
569  return getMMI().hasDebugInfo() ||
572 }
573 
574 namespace llvm {
575 
576  template<>
579 
580  static std::string getGraphName(const MachineFunction *F) {
581  return ("CFG for '" + F->getName() + "' function").str();
582  }
583 
584  std::string getNodeLabel(const MachineBasicBlock *Node,
585  const MachineFunction *Graph) {
586  std::string OutStr;
587  {
588  raw_string_ostream OSS(OutStr);
589 
590  if (isSimple()) {
591  OSS << printMBBReference(*Node);
592  if (const BasicBlock *BB = Node->getBasicBlock())
593  OSS << ": " << BB->getName();
594  } else
595  Node->print(OSS);
596  }
597 
598  if (OutStr[0] == '\n') OutStr.erase(OutStr.begin());
599 
600  // Process string output to make it nicer...
601  for (unsigned i = 0; i != OutStr.length(); ++i)
602  if (OutStr[i] == '\n') { // Left justify
603  OutStr[i] = '\\';
604  OutStr.insert(OutStr.begin()+i+1, 'l');
605  }
606  return OutStr;
607  }
608  };
609 
610 } // end namespace llvm
611 
613 {
614 #ifndef NDEBUG
615  ViewGraph(this, "mf" + getName());
616 #else
617  errs() << "MachineFunction::viewCFG is only available in debug builds on "
618  << "systems with Graphviz or gv!\n";
619 #endif // NDEBUG
620 }
621 
623 {
624 #ifndef NDEBUG
625  ViewGraph(this, "mf" + getName(), true);
626 #else
627  errs() << "MachineFunction::viewCFGOnly is only available in debug builds on "
628  << "systems with Graphviz or gv!\n";
629 #endif // NDEBUG
630 }
631 
632 /// Add the specified physical register as a live-in value and
633 /// create a corresponding virtual register for it.
635  const TargetRegisterClass *RC) {
637  Register VReg = MRI.getLiveInVirtReg(PReg);
638  if (VReg) {
639  const TargetRegisterClass *VRegRC = MRI.getRegClass(VReg);
640  (void)VRegRC;
641  // A physical register can be added several times.
642  // Between two calls, the register class of the related virtual register
643  // may have been constrained to match some operation constraints.
644  // In that case, check that the current register class includes the
645  // physical register and is a sub class of the specified RC.
646  assert((VRegRC == RC || (VRegRC->contains(PReg) &&
647  RC->hasSubClassEq(VRegRC))) &&
648  "Register class mismatch!");
649  return VReg;
650  }
651  VReg = MRI.createVirtualRegister(RC);
652  MRI.addLiveIn(PReg, VReg);
653  return VReg;
654 }
655 
656 /// Return the MCSymbol for the specified non-empty jump table.
657 /// If isLinkerPrivate is specified, an 'l' label is returned, otherwise a
658 /// normal 'L' label is returned.
660  bool isLinkerPrivate) const {
661  const DataLayout &DL = getDataLayout();
662  assert(JumpTableInfo && "No jump tables");
663  assert(JTI < JumpTableInfo->getJumpTables().size() && "Invalid JTI!");
664 
665  StringRef Prefix = isLinkerPrivate ? DL.getLinkerPrivateGlobalPrefix()
666  : DL.getPrivateGlobalPrefix();
669  << Prefix << "JTI" << getFunctionNumber() << '_' << JTI;
670  return Ctx.getOrCreateSymbol(Name);
671 }
672 
673 /// Return a function-local symbol to represent the PIC base.
675  const DataLayout &DL = getDataLayout();
676  return Ctx.getOrCreateSymbol(Twine(DL.getPrivateGlobalPrefix()) +
677  Twine(getFunctionNumber()) + "$pb");
678 }
679 
680 /// \name Exception Handling
681 /// \{
682 
685  unsigned N = LandingPads.size();
686  for (unsigned i = 0; i < N; ++i) {
687  LandingPadInfo &LP = LandingPads[i];
688  if (LP.LandingPadBlock == LandingPad)
689  return LP;
690  }
691 
692  LandingPads.push_back(LandingPadInfo(LandingPad));
693  return LandingPads[N];
694 }
695 
697  MCSymbol *BeginLabel, MCSymbol *EndLabel) {
698  LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);
699  LP.BeginLabels.push_back(BeginLabel);
700  LP.EndLabels.push_back(EndLabel);
701 }
702 
704  MCSymbol *LandingPadLabel = Ctx.createTempSymbol();
705  LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);
706  LP.LandingPadLabel = LandingPadLabel;
707 
708  const Instruction *FirstI = LandingPad->getBasicBlock()->getFirstNonPHI();
709  if (const auto *LPI = dyn_cast<LandingPadInst>(FirstI)) {
710  if (const auto *PF =
711  dyn_cast<Function>(F.getPersonalityFn()->stripPointerCasts()))
712  getMMI().addPersonality(PF);
713 
714  if (LPI->isCleanup())
715  addCleanup(LandingPad);
716 
717  // FIXME: New EH - Add the clauses in reverse order. This isn't 100%
718  // correct, but we need to do it this way because of how the DWARF EH
719  // emitter processes the clauses.
720  for (unsigned I = LPI->getNumClauses(); I != 0; --I) {
721  Value *Val = LPI->getClause(I - 1);
722  if (LPI->isCatch(I - 1)) {
723  addCatchTypeInfo(LandingPad,
724  dyn_cast<GlobalValue>(Val->stripPointerCasts()));
725  } else {
726  // Add filters in a list.
727  auto *CVal = cast<Constant>(Val);
729  for (User::op_iterator II = CVal->op_begin(), IE = CVal->op_end();
730  II != IE; ++II)
731  FilterList.push_back(cast<GlobalValue>((*II)->stripPointerCasts()));
732 
733  addFilterTypeInfo(LandingPad, FilterList);
734  }
735  }
736 
737  } else if (const auto *CPI = dyn_cast<CatchPadInst>(FirstI)) {
738  for (unsigned I = CPI->getNumArgOperands(); I != 0; --I) {
739  Value *TypeInfo = CPI->getArgOperand(I - 1)->stripPointerCasts();
740  addCatchTypeInfo(LandingPad, dyn_cast<GlobalValue>(TypeInfo));
741  }
742 
743  } else {
744  assert(isa<CleanupPadInst>(FirstI) && "Invalid landingpad!");
745  }
746 
747  return LandingPadLabel;
748 }
749 
752  LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);
753  for (unsigned N = TyInfo.size(); N; --N)
754  LP.TypeIds.push_back(getTypeIDFor(TyInfo[N - 1]));
755 }
756 
759  LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);
760  std::vector<unsigned> IdsInFilter(TyInfo.size());
761  for (unsigned I = 0, E = TyInfo.size(); I != E; ++I)
762  IdsInFilter[I] = getTypeIDFor(TyInfo[I]);
763  LP.TypeIds.push_back(getFilterIDFor(IdsInFilter));
764 }
765 
767  bool TidyIfNoBeginLabels) {
768  for (unsigned i = 0; i != LandingPads.size(); ) {
769  LandingPadInfo &LandingPad = LandingPads[i];
770  if (LandingPad.LandingPadLabel &&
771  !LandingPad.LandingPadLabel->isDefined() &&
772  (!LPMap || (*LPMap)[LandingPad.LandingPadLabel] == 0))
773  LandingPad.LandingPadLabel = nullptr;
774 
775  // Special case: we *should* emit LPs with null LP MBB. This indicates
776  // "nounwind" case.
777  if (!LandingPad.LandingPadLabel && LandingPad.LandingPadBlock) {
778  LandingPads.erase(LandingPads.begin() + i);
779  continue;
780  }
781 
782  if (TidyIfNoBeginLabels) {
783  for (unsigned j = 0, e = LandingPads[i].BeginLabels.size(); j != e; ++j) {
784  MCSymbol *BeginLabel = LandingPad.BeginLabels[j];
785  MCSymbol *EndLabel = LandingPad.EndLabels[j];
786  if ((BeginLabel->isDefined() || (LPMap && (*LPMap)[BeginLabel] != 0)) &&
787  (EndLabel->isDefined() || (LPMap && (*LPMap)[EndLabel] != 0)))
788  continue;
789 
790  LandingPad.BeginLabels.erase(LandingPad.BeginLabels.begin() + j);
791  LandingPad.EndLabels.erase(LandingPad.EndLabels.begin() + j);
792  --j;
793  --e;
794  }
795 
796  // Remove landing pads with no try-ranges.
797  if (LandingPads[i].BeginLabels.empty()) {
798  LandingPads.erase(LandingPads.begin() + i);
799  continue;
800  }
801  }
802 
803  // If there is no landing pad, ensure that the list of typeids is empty.
804  // If the only typeid is a cleanup, this is the same as having no typeids.
805  if (!LandingPad.LandingPadBlock ||
806  (LandingPad.TypeIds.size() == 1 && !LandingPad.TypeIds[0]))
807  LandingPad.TypeIds.clear();
808  ++i;
809  }
810 }
811 
813  LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);
814  LP.TypeIds.push_back(0);
815 }
816 
818  const Function *Filter,
819  const BlockAddress *RecoverBA) {
820  LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);
821  SEHHandler Handler;
822  Handler.FilterOrFinally = Filter;
823  Handler.RecoverBA = RecoverBA;
824  LP.SEHHandlers.push_back(Handler);
825 }
826 
828  const Function *Cleanup) {
829  LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);
830  SEHHandler Handler;
831  Handler.FilterOrFinally = Cleanup;
832  Handler.RecoverBA = nullptr;
833  LP.SEHHandlers.push_back(Handler);
834 }
835 
837  ArrayRef<unsigned> Sites) {
838  LPadToCallSiteMap[Sym].append(Sites.begin(), Sites.end());
839 }
840 
842  for (unsigned i = 0, N = TypeInfos.size(); i != N; ++i)
843  if (TypeInfos[i] == TI) return i + 1;
844 
845  TypeInfos.push_back(TI);
846  return TypeInfos.size();
847 }
848 
849 int MachineFunction::getFilterIDFor(std::vector<unsigned> &TyIds) {
850  // If the new filter coincides with the tail of an existing filter, then
851  // re-use the existing filter. Folding filters more than this requires
852  // re-ordering filters and/or their elements - probably not worth it.
853  for (unsigned i : FilterEnds) {
854  unsigned j = TyIds.size();
855 
856  while (i && j)
857  if (FilterIds[--i] != TyIds[--j])
858  goto try_next;
859 
860  if (!j)
861  // The new filter coincides with range [i, end) of the existing filter.
862  return -(1 + i);
863 
864 try_next:;
865  }
866 
867  // Add the new filter.
868  int FilterID = -(1 + FilterIds.size());
869  FilterIds.reserve(FilterIds.size() + TyIds.size() + 1);
870  llvm::append_range(FilterIds, TyIds);
871  FilterEnds.push_back(FilterIds.size());
872  FilterIds.push_back(0); // terminator
873  return FilterID;
874 }
875 
877 MachineFunction::getCallSiteInfo(const MachineInstr *MI) {
878  assert(MI->isCandidateForCallSiteEntry() &&
879  "Call site info refers only to call (MI) candidates");
880 
881  if (!Target.Options.EmitCallSiteInfo)
882  return CallSitesInfo.end();
883  return CallSitesInfo.find(MI);
884 }
885 
886 /// Return the call machine instruction or find a call within bundle.
887 static const MachineInstr *getCallInstr(const MachineInstr *MI) {
888  if (!MI->isBundle())
889  return MI;
890 
891  for (auto &BMI : make_range(getBundleStart(MI->getIterator()),
892  getBundleEnd(MI->getIterator())))
893  if (BMI.isCandidateForCallSiteEntry())
894  return &BMI;
895 
896  llvm_unreachable("Unexpected bundle without a call site candidate");
897 }
898 
900  assert(MI->shouldUpdateCallSiteInfo() &&
901  "Call site info refers only to call (MI) candidates or "
902  "candidates inside bundles");
903 
904  const MachineInstr *CallMI = getCallInstr(MI);
905  CallSiteInfoMap::iterator CSIt = getCallSiteInfo(CallMI);
906  if (CSIt == CallSitesInfo.end())
907  return;
908  CallSitesInfo.erase(CSIt);
909 }
910 
912  const MachineInstr *New) {
914  "Call site info refers only to call (MI) candidates or "
915  "candidates inside bundles");
916 
917  if (!New->isCandidateForCallSiteEntry())
918  return eraseCallSiteInfo(Old);
919 
920  const MachineInstr *OldCallMI = getCallInstr(Old);
921  CallSiteInfoMap::iterator CSIt = getCallSiteInfo(OldCallMI);
922  if (CSIt == CallSitesInfo.end())
923  return;
924 
925  CallSiteInfo CSInfo = CSIt->second;
926  CallSitesInfo[New] = CSInfo;
927 }
928 
930  const MachineInstr *New) {
932  "Call site info refers only to call (MI) candidates or "
933  "candidates inside bundles");
934 
935  if (!New->isCandidateForCallSiteEntry())
936  return eraseCallSiteInfo(Old);
937 
938  const MachineInstr *OldCallMI = getCallInstr(Old);
939  CallSiteInfoMap::iterator CSIt = getCallSiteInfo(OldCallMI);
940  if (CSIt == CallSitesInfo.end())
941  return;
942 
943  CallSiteInfo CSInfo = std::move(CSIt->second);
944  CallSitesInfo.erase(CSIt);
945  CallSitesInfo[New] = CSInfo;
946 }
947 
950 }
951 
954  auto Result = DebugValueSubstitutions.insert(std::make_pair(A, B));
955  (void)Result;
956  assert(Result.second && "Substitution for an already substituted value?");
957 }
958 
960  MachineInstr &New,
961  unsigned MaxOperand) {
962  // If the Old instruction wasn't tracked at all, there is no work to do.
963  unsigned OldInstrNum = Old.peekDebugInstrNum();
964  if (!OldInstrNum)
965  return;
966 
967  // Iterate over all operands looking for defs to create substitutions for.
968  // Avoid creating new instr numbers unless we create a new substitution.
969  // While this has no functional effect, it risks confusing someone reading
970  // MIR output.
971  // Examine all the operands, or the first N specified by the caller.
972  MaxOperand = std::min(MaxOperand, Old.getNumOperands());
973  for (unsigned int I = 0; I < Old.getNumOperands(); ++I) {
974  const auto &OldMO = Old.getOperand(I);
975  auto &NewMO = New.getOperand(I);
976  (void)NewMO;
977 
978  if (!OldMO.isReg() || !OldMO.isDef())
979  continue;
980  assert(NewMO.isDef());
981 
982  unsigned NewInstrNum = New.getDebugInstrNum();
983  makeDebugValueSubstitution(std::make_pair(OldInstrNum, I),
984  std::make_pair(NewInstrNum, I));
985  }
986 }
987 
988 /// \}
989 
990 //===----------------------------------------------------------------------===//
991 // MachineJumpTableInfo implementation
992 //===----------------------------------------------------------------------===//
993 
994 /// Return the size of each entry in the jump table.
996  // The size of a jump table entry is 4 bytes unless the entry is just the
997  // address of a block, in which case it is the pointer size.
998  switch (getEntryKind()) {
1000  return TD.getPointerSize();
1002  return 8;
1006  return 4;
1008  return 0;
1009  }
1010  llvm_unreachable("Unknown jump table encoding!");
1011 }
1012 
1013 /// Return the alignment of each entry in the jump table.
1015  // The alignment of a jump table entry is the alignment of int32 unless the
1016  // entry is just the address of a block, in which case it is the pointer
1017  // alignment.
1018  switch (getEntryKind()) {
1020  return TD.getPointerABIAlignment(0).value();
1022  return TD.getABIIntegerTypeAlignment(64).value();
1026  return TD.getABIIntegerTypeAlignment(32).value();
1028  return 1;
1029  }
1030  llvm_unreachable("Unknown jump table encoding!");
1031 }
1032 
1033 /// Create a new jump table entry in the jump table info.
1035  const std::vector<MachineBasicBlock*> &DestBBs) {
1036  assert(!DestBBs.empty() && "Cannot create an empty jump table!");
1037  JumpTables.push_back(MachineJumpTableEntry(DestBBs));
1038  return JumpTables.size()-1;
1039 }
1040 
1041 /// If Old is the target of any jump tables, update the jump tables to branch
1042 /// to New instead.
1044  MachineBasicBlock *New) {
1045  assert(Old != New && "Not making a change?");
1046  bool MadeChange = false;
1047  for (size_t i = 0, e = JumpTables.size(); i != e; ++i)
1048  ReplaceMBBInJumpTable(i, Old, New);
1049  return MadeChange;
1050 }
1051 
1052 /// If MBB is present in any jump tables, remove it.
1054  bool MadeChange = false;
1055  for (MachineJumpTableEntry &JTE : JumpTables) {
1056  auto removeBeginItr = std::remove(JTE.MBBs.begin(), JTE.MBBs.end(), MBB);
1057  MadeChange |= (removeBeginItr != JTE.MBBs.end());
1058  JTE.MBBs.erase(removeBeginItr, JTE.MBBs.end());
1059  }
1060  return MadeChange;
1061 }
1062 
1063 /// If Old is a target of the jump tables, update the jump table to branch to
1064 /// New instead.
1066  MachineBasicBlock *Old,
1067  MachineBasicBlock *New) {
1068  assert(Old != New && "Not making a change?");
1069  bool MadeChange = false;
1070  MachineJumpTableEntry &JTE = JumpTables[Idx];
1071  for (size_t j = 0, e = JTE.MBBs.size(); j != e; ++j)
1072  if (JTE.MBBs[j] == Old) {
1073  JTE.MBBs[j] = New;
1074  MadeChange = true;
1075  }
1076  return MadeChange;
1077 }
1078 
1080  if (JumpTables.empty()) return;
1081 
1082  OS << "Jump Tables:\n";
1083 
1084  for (unsigned i = 0, e = JumpTables.size(); i != e; ++i) {
1085  OS << printJumpTableEntryReference(i) << ':';
1086  for (unsigned j = 0, f = JumpTables[i].MBBs.size(); j != f; ++j)
1087  OS << ' ' << printMBBReference(*JumpTables[i].MBBs[j]);
1088  if (i != e)
1089  OS << '\n';
1090  }
1091 
1092  OS << '\n';
1093 }
1094 
1095 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
1097 #endif
1098 
1100  return Printable([Idx](raw_ostream &OS) { OS << "%jump-table." << Idx; });
1101 }
1102 
1103 //===----------------------------------------------------------------------===//
1104 // MachineConstantPool implementation
1105 //===----------------------------------------------------------------------===//
1106 
1107 void MachineConstantPoolValue::anchor() {}
1108 
1110  return DL.getTypeAllocSize(Ty);
1111 }
1112 
1115  return Val.MachineCPVal->getSizeInBytes(DL);
1116  return DL.getTypeAllocSize(Val.ConstVal->getType());
1117 }
1118 
1121  return true;
1122  return Val.ConstVal->needsDynamicRelocation();
1123 }
1124 
1127  if (needsRelocation())
1129  switch (getSizeInBytes(*DL)) {
1130  case 4:
1132  case 8:
1134  case 16:
1136  case 32:
1138  default:
1139  return SectionKind::getReadOnly();
1140  }
1141 }
1142 
1144  // A constant may be a member of both Constants and MachineCPVsSharingEntries,
1145  // so keep track of which we've deleted to avoid double deletions.
1147  for (unsigned i = 0, e = Constants.size(); i != e; ++i)
1148  if (Constants[i].isMachineConstantPoolEntry()) {
1149  Deleted.insert(Constants[i].Val.MachineCPVal);
1150  delete Constants[i].Val.MachineCPVal;
1151  }
1152  for (MachineConstantPoolValue *CPV : MachineCPVsSharingEntries) {
1153  if (Deleted.count(CPV) == 0)
1154  delete CPV;
1155  }
1156 }
1157 
1158 /// Test whether the given two constants can be allocated the same constant pool
1159 /// entry.
1160 static bool CanShareConstantPoolEntry(const Constant *A, const Constant *B,
1161  const DataLayout &DL) {
1162  // Handle the trivial case quickly.
1163  if (A == B) return true;
1164 
1165  // If they have the same type but weren't the same constant, quickly
1166  // reject them.
1167  if (A->getType() == B->getType()) return false;
1168 
1169  // We can't handle structs or arrays.
1170  if (isa<StructType>(A->getType()) || isa<ArrayType>(A->getType()) ||
1171  isa<StructType>(B->getType()) || isa<ArrayType>(B->getType()))
1172  return false;
1173 
1174  // For now, only support constants with the same size.
1175  uint64_t StoreSize = DL.getTypeStoreSize(A->getType());
1176  if (StoreSize != DL.getTypeStoreSize(B->getType()) || StoreSize > 128)
1177  return false;
1178 
1179  Type *IntTy = IntegerType::get(A->getContext(), StoreSize*8);
1180 
1181  // Try constant folding a bitcast of both instructions to an integer. If we
1182  // get two identical ConstantInt's, then we are good to share them. We use
1183  // the constant folding APIs to do this so that we get the benefit of
1184  // DataLayout.
1185  if (isa<PointerType>(A->getType()))
1186  A = ConstantFoldCastOperand(Instruction::PtrToInt,
1187  const_cast<Constant *>(A), IntTy, DL);
1188  else if (A->getType() != IntTy)
1189  A = ConstantFoldCastOperand(Instruction::BitCast, const_cast<Constant *>(A),
1190  IntTy, DL);
1191  if (isa<PointerType>(B->getType()))
1192  B = ConstantFoldCastOperand(Instruction::PtrToInt,
1193  const_cast<Constant *>(B), IntTy, DL);
1194  else if (B->getType() != IntTy)
1195  B = ConstantFoldCastOperand(Instruction::BitCast, const_cast<Constant *>(B),
1196  IntTy, DL);
1197 
1198  return A == B;
1199 }
1200 
1201 /// Create a new entry in the constant pool or return an existing one.
1202 /// User must specify the log2 of the minimum required alignment for the object.
1204  Align Alignment) {
1205  if (Alignment > PoolAlignment) PoolAlignment = Alignment;
1206 
1207  // Check to see if we already have this constant.
1208  //
1209  // FIXME, this could be made much more efficient for large constant pools.
1210  for (unsigned i = 0, e = Constants.size(); i != e; ++i)
1211  if (!Constants[i].isMachineConstantPoolEntry() &&
1212  CanShareConstantPoolEntry(Constants[i].Val.ConstVal, C, DL)) {
1213  if (Constants[i].getAlign() < Alignment)
1214  Constants[i].Alignment = Alignment;
1215  return i;
1216  }
1217 
1218  Constants.push_back(MachineConstantPoolEntry(C, Alignment));
1219  return Constants.size()-1;
1220 }
1221 
1223  Align Alignment) {
1224  if (Alignment > PoolAlignment) PoolAlignment = Alignment;
1225 
1226  // Check to see if we already have this constant.
1227  //
1228  // FIXME, this could be made much more efficient for large constant pools.
1229  int Idx = V->getExistingMachineCPValue(this, Alignment);
1230  if (Idx != -1) {
1231  MachineCPVsSharingEntries.insert(V);
1232  return (unsigned)Idx;
1233  }
1234 
1235  Constants.push_back(MachineConstantPoolEntry(V, Alignment));
1236  return Constants.size()-1;
1237 }
1238 
1240  if (Constants.empty()) return;
1241 
1242  OS << "Constant Pool:\n";
1243  for (unsigned i = 0, e = Constants.size(); i != e; ++i) {
1244  OS << " cp#" << i << ": ";
1245  if (Constants[i].isMachineConstantPoolEntry())
1246  Constants[i].Val.MachineCPVal->print(OS);
1247  else
1248  Constants[i].Val.ConstVal->printAsOperand(OS, /*PrintType=*/false);
1249  OS << ", align=" << Constants[i].getAlign().value();
1250  OS << "\n";
1251  }
1252 }
1253 
1254 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
1256 #endif
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
llvm::MachineRegisterInfo::addLiveIn
void addLiveIn(MCRegister Reg, Register vreg=Register())
addLiveIn - Add the specified register as a live-in.
Definition: MachineRegisterInfo.h:944
i
i
Definition: README.txt:29
llvm::WasmEHFuncInfo
Definition: WasmEHFuncInfo.h:32
llvm::DOTGraphTraits< const MachineFunction * >::getNodeLabel
std::string getNodeLabel(const MachineBasicBlock *Node, const MachineFunction *Graph)
Definition: MachineFunction.cpp:584
llvm::SectionKind::getReadOnlyWithRel
static SectionKind getReadOnlyWithRel()
Definition: SectionKind.h:207
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:102
MachineInstr.h
LLVM_DUMP_METHOD
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Definition: Compiler.h:499
llvm::PointerUnion::isNull
bool isNull() const
Test if the pointer held in the union is null, regardless of which type it is.
Definition: PointerUnion.h:172
llvm::MachineConstantPool::getConstantPoolIndex
unsigned getConstantPoolIndex(const Constant *C, Align Alignment)
getConstantPoolIndex - Create a new entry in the constant pool or return an existing one.
Definition: MachineFunction.cpp:1203
llvm
Definition: AllocatorList.h:23
llvm::MachineJumpTableInfo::RemoveMBBFromJumpTables
bool RemoveMBBFromJumpTables(MachineBasicBlock *MBB)
RemoveMBBFromJumpTables - If MBB is present in any jump tables, remove it.
Definition: MachineFunction.cpp:1053
llvm::dwarf::Constants
Constants
Definition: Dwarf.h:427
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
llvm::make_range
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Definition: iterator_range.h:53
TargetFrameLowering.h
llvm::MachineJumpTableInfo::createJumpTableIndex
unsigned createJumpTableIndex(const std::vector< MachineBasicBlock * > &DestBBs)
createJumpTableIndex - Create a new jump table.
Definition: MachineFunction.cpp:1034
llvm::DataLayout
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:112
llvm::MachineBasicBlock::getBasicBlock
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
Definition: MachineBasicBlock.h:202
Metadata.h
llvm::MachineRegisterInfo::createVirtualRegister
Register createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
Definition: MachineRegisterInfo.cpp:158
llvm::MachineFunction::DebugInstrOperandPair
std::pair< unsigned, unsigned > DebugInstrOperandPair
Pair of instruction number and operand number.
Definition: MachineFunction.h:452
llvm::MachineFunction::allocateRegMask
uint32_t * allocateRegMask()
Allocate and initialize a register mask with NumRegister bits.
Definition: MachineFunction.cpp:502
llvm::MachineFunctionProperties::print
void print(raw_ostream &OS) const
Print the MachineFunctionProperties in human-readable form.
Definition: MachineFunction.cpp:109
DebugInfoMetadata.h
llvm::cl::Prefix
@ Prefix
Definition: CommandLine.h:164
llvm::MachineRegisterInfo
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Definition: MachineRegisterInfo.h:52
llvm::MCContext
Context object for machine code objects.
Definition: MCContext.h:71
llvm::Function
Definition: Function.h:61
llvm::MachineFunctionProperties::Property
Property
Definition: MachineFunction.h:152
llvm::MachineFunction::getContext
MCContext & getContext() const
Definition: MachineFunction.h:528
StringRef.h
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
llvm::MachineFunction::assignBeginEndSections
void assignBeginEndSections()
Assign IsBeginSection IsEndSection fields for basic blocks in this function.
Definition: MachineFunction.cpp:334
llvm::raw_string_ostream
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:614
llvm::Target
Target - Wrapper for Target specific information.
Definition: TargetRegistry.h:125
llvm::Function::getFnStackAlign
MaybeAlign getFnStackAlign() const
Return the stack alignment for the function.
Definition: Function.h:385
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1167
AlignAllFunctions
static cl::opt< unsigned > AlignAllFunctions("align-all-functions", cl::desc("Force the alignment of all functions in log2 format (e.g. 4 " "means align on 16B boundaries)."), cl::init(0), cl::Hidden)
llvm::TargetLoweringBase::getPrefFunctionAlignment
Align getPrefFunctionAlignment() const
Return the preferred function alignment.
Definition: TargetLowering.h:1756
llvm::MachineFunction::end
iterator end()
Definition: MachineFunction.h:760
llvm::LandingPadInfo::LandingPadLabel
MCSymbol * LandingPadLabel
Definition: MachineFunction.h:223
llvm::MachineFunction::getMachineMemOperand
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, uint64_t s, Align base_alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
Definition: MachineFunction.cpp:430
llvm::MachineMemOperand::getOffset
int64_t getOffset() const
For normal values, this is a byte offset added to the base address.
Definition: MachineMemOperand.h:216
llvm::printMBBReference
Printable printMBBReference(const MachineBasicBlock &MBB)
Prints a machine basic block reference.
Definition: MachineBasicBlock.cpp:119
llvm::MachineRegisterInfo::livein_empty
bool livein_empty() const
Definition: MachineRegisterInfo.h:954
ErrorHandling.h
llvm::LandingPadInfo::SEHHandlers
SmallVector< SEHHandler, 1 > SEHHandlers
Definition: MachineFunction.h:222
llvm::MachineFunction::copyCallSiteInfo
void copyCallSiteInfo(const MachineInstr *Old, const MachineInstr *New)
Copy the call site info from Old to \ New.
Definition: MachineFunction.cpp:911
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::MachineFunction::getOrCreateJumpTableInfo
MachineJumpTableInfo * getOrCreateJumpTableInfo(unsigned JTEntryKind)
getOrCreateJumpTableInfo - Get the JumpTableInfo for this function, if it does already exist,...
Definition: MachineFunction.cpp:267
llvm::MachineFunction::getFunctionNumber
unsigned getFunctionNumber() const
getFunctionNumber - Return a unique ID for the current function.
Definition: MachineFunction.h:551
llvm::MachineInstr::bundleWithPred
void bundleWithPred()
Bundle this instruction with its predecessor.
Definition: MachineInstr.cpp:759
llvm::MachineFunction::back
const MachineBasicBlock & back() const
Definition: MachineFunction.h:772
MachineBasicBlock.h
llvm::ConstantPool
Definition: ConstantPools.h:43
llvm::TargetSubtargetInfo::getRegisterInfo
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
Definition: TargetSubtargetInfo.h:124
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:143
llvm::DenseMapBase::erase
bool erase(const KeyT &Val)
Definition: DenseMap.h:302
llvm::MachineModuleInfo::hasDebugInfo
bool hasDebugInfo() const
Returns true if valid debug info is present.
Definition: MachineModuleInfo.h:203
llvm::TargetRegisterInfo
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Definition: TargetRegisterInfo.h:231
llvm::MachineFunction::moveCallSiteInfo
void moveCallSiteInfo(const MachineInstr *Old, const MachineInstr *New)
Move the call site info from Old to \New call site info.
Definition: MachineFunction.cpp:929
llvm::MachineConstantPoolValue
Abstract base class for all machine specific constantpool value subclasses.
Definition: MachineConstantPool.h:35
llvm::AAMDNodes
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
Definition: Metadata.h:651
llvm::DenseMapIterator
Definition: DenseMap.h:56
llvm::MachineFunction::Delegate::MF_HandleRemoval
virtual void MF_HandleRemoval(MachineInstr &MI)=0
Callback before a removal. This should not modify the MI directly.
MachineJumpTableInfo.h
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:46
DenseMap.h
Module.h
llvm::MCSymbol::isDefined
bool isDefined() const
isDefined - Check if this symbol is defined (i.e., it has an address).
Definition: MCSymbol.h:242
TargetInstrInfo.h
llvm::SectionKind::getMergeableConst16
static SectionKind getMergeableConst16()
Definition: SectionKind.h:197
llvm::MachineMemOperand
A description of a memory reference used in the backend.
Definition: MachineMemOperand.h:127
EHPersonalities.h
llvm::MachineRegisterInfo::getLiveInVirtReg
Register getLiveInVirtReg(MCRegister PReg) const
getLiveInVirtReg - If PReg is a live-in physical register, return the corresponding live-in physical ...
Definition: MachineRegisterInfo.cpp:454
llvm::copy
OutputIt copy(R &&Range, OutputIt Out)
Definition: STLExtras.h:1533
llvm::MachineFunction::setCallSiteLandingPad
void setCallSiteLandingPad(MCSymbol *Sym, ArrayRef< unsigned > Sites)
Map the landing pad's EH symbol to the call site indexes.
Definition: MachineFunction.cpp:836
llvm::MachineJumpTableInfo::EK_BlockAddress
@ EK_BlockAddress
EK_BlockAddress - Each entry is a plain address of block, e.g.
Definition: MachineJumpTableInfo.h:49
llvm::MachineFunctionProperties::Property::IsSSA
@ IsSSA
llvm::Function::hasFnAttribute
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
Definition: Function.h:355
getFnStackAlignment
static unsigned getFnStackAlignment(const TargetSubtargetInfo *STI, const Function &F)
Definition: MachineFunction.cpp:130
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:81
llvm::MachineInstr::peekDebugInstrNum
unsigned peekDebugInstrNum() const
Examine the instruction number of this MachineInstr.
Definition: MachineInstr.h:460
llvm::MachineFunction::addSEHCatchHandler
void addSEHCatchHandler(MachineBasicBlock *LandingPad, const Function *Filter, const BlockAddress *RecoverBA)
Definition: MachineFunction.cpp:817
llvm::errs
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
Definition: raw_ostream.cpp:892
llvm::ViewGraph
void ViewGraph(const GraphType &G, const Twine &Name, bool ShortNames=false, const Twine &Title="", GraphProgram::Name Program=GraphProgram::DOT)
ViewGraph - Emit a dot graph, run 'dot', run gv on the postscript file, then cleanup.
Definition: GraphWriter.h:375
llvm::ModuleSlotTracker::incorporateFunction
void incorporateFunction(const Function &F)
Incorporate the given function.
Definition: AsmWriter.cpp:899
STLExtras.h
llvm::MachineFunction::getJTISymbol
MCSymbol * getJTISymbol(unsigned JTI, MCContext &Ctx, bool isLinkerPrivate=false) const
getJTISymbol - Return the MCSymbol for the specified non-empty jump table.
Definition: MachineFunction.cpp:659
llvm::MachineMemOperand::getAAInfo
AAMDNodes getAAInfo() const
Return the AA tags for the memory reference.
Definition: MachineMemOperand.h:235
llvm::MachineJumpTableInfo::EK_Custom32
@ EK_Custom32
EK_Custom32 - Each entry is a 32-bit value that is custom lowered by the TargetLowering::LowerCustomJ...
Definition: MachineJumpTableInfo.h:76
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:29
TRI
unsigned const TargetRegisterInfo * TRI
Definition: MachineSink.cpp:1567
ConstantFolding.h
llvm::SEHHandler::FilterOrFinally
const Function * FilterOrFinally
Filter or finally function. Null indicates a catch-all.
Definition: MachineFunction.h:211
F
#define F(x, y, z)
Definition: MD5.cpp:56
getPropertyName
static const char * getPropertyName(MachineFunctionProperties::Property Prop)
Definition: MachineFunction.cpp:89
llvm::MachineFunction::iterator
BasicBlockListType::iterator iterator
Definition: MachineFunction.h:740
MachineRegisterInfo.h
llvm::iplist_impl::erase
iterator erase(iterator where)
Definition: ilist.h:267
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:58
llvm::MachineJumpTableInfo::getEntrySize
unsigned getEntrySize(const DataLayout &TD) const
getEntrySize - Return the size of each entry in the jump table.
Definition: MachineFunction.cpp:995
llvm::getBundleEnd
MachineBasicBlock::instr_iterator getBundleEnd(MachineBasicBlock::instr_iterator I)
Returns an iterator pointing beyond the bundle containing I.
Definition: MachineInstrBundle.h:60
llvm::MachineJumpTableInfo::ReplaceMBBInJumpTables
bool ReplaceMBBInJumpTables(MachineBasicBlock *Old, MachineBasicBlock *New)
ReplaceMBBInJumpTables - If Old is the target of any jump tables, update the jump tables to branch to...
Definition: MachineFunction.cpp:1043
llvm::MachineJumpTableInfo::getEntryKind
JTEntryKind getEntryKind() const
Definition: MachineJumpTableInfo.h:84
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:132
llvm::MachineJumpTableInfo::dump
void dump() const
dump - Call to stderr.
Definition: MachineFunction.cpp:1096
llvm::classifyEHPersonality
EHPersonality classifyEHPersonality(const Value *Pers)
See if the given exception handling personality function is one that we understand.
Definition: EHPersonalities.cpp:21
llvm::SectionKind::getReadOnly
static SectionKind getReadOnly()
Definition: SectionKind.h:185
llvm::MachineMemOperand::getPointerInfo
const MachinePointerInfo & getPointerInfo() const
Definition: MachineMemOperand.h:191
LoopDeletionResult::Deleted
@ Deleted
Instruction.h
CommandLine.h
TargetLowering.h
llvm::MachineFunction::substituteDebugValuesForInst
void substituteDebugValuesForInst(const MachineInstr &Old, MachineInstr &New, unsigned MaxOperand=UINT_MAX)
Create substitutions for any tracked values in Old, to point at New.
Definition: MachineFunction.cpp:959
llvm::TargetRegisterClass::contains
bool contains(Register Reg) const
Return true if the specified register is included in this register class.
Definition: TargetRegisterInfo.h:91
bb
< i1 > br i1 label label bb bb
Definition: README.txt:978
llvm::MachineFunction::front
const MachineBasicBlock & front() const
Definition: MachineFunction.h:770
llvm::MachineFunction::getRegInfo
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Definition: MachineFunction.h:586
llvm::MCContext::getOrCreateSymbol
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
Definition: MCContext.cpp:187
GlobalValue.h
TargetMachine.h
llvm::BumpPtrAllocatorImpl::Allocate
LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ATTRIBUTE_RETURNS_NOALIAS void * Allocate(size_t Size, Align Alignment)
Allocate space at the specified alignment.
Definition: Allocator.h:145
llvm::MachineMemOperand::getBaseAlign
Align getBaseAlign() const
Return the minimum known alignment in bytes of the base address, without the offset.
Definition: MachineMemOperand.h:232
llvm::LandingPadInfo::EndLabels
SmallVector< MCSymbol *, 1 > EndLabels
Definition: MachineFunction.h:221
SmallString.h
f
Itanium Name Demangler i e convert the string _Z1fv into f()". You can also use the CRTP base ManglingParser to perform some simple analysis on the mangled name
llvm::MachineFrameInfo::ensureMaxAlignment
void ensureMaxAlignment(Align Alignment)
Make sure the function is at least Align bytes aligned.
Definition: MachineFrameInfo.cpp:31
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::MachineOperand::getRegMaskSize
static unsigned getRegMaskSize(unsigned NumRegs)
Returns number of elements needed for a regmask array.
Definition: MachineOperand.h:636
llvm::ConstantFoldCastOperand
Constant * ConstantFoldCastOperand(unsigned Opcode, Constant *C, Type *DestTy, const DataLayout &DL)
Attempt to constant fold a cast with the specified operand.
Definition: ConstantFolding.cpp:1376
llvm::MachineMemOperand::getValue
const Value * getValue() const
Return the base address of the memory access.
Definition: MachineMemOperand.h:200
llvm::TargetFrameLowering::getStackAlign
Align getStackAlign() const
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligne...
Definition: TargetFrameLowering.h:100
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::MachineInstr::getOperand
const MachineOperand & getOperand(unsigned i) const
Definition: MachineInstr.h:488
llvm::MachineFunction::getDenormalMode
DenormalMode getDenormalMode(const fltSemantics &FPType) const
Returns the denormal handling type for the default rounding mode of the function.
Definition: MachineFunction.cpp:275
llvm::TargetOptions::ForceDwarfFrameSection
unsigned ForceDwarfFrameSection
Emit DWARF debug frame section.
Definition: TargetOptions.h:320
Twine.h
llvm::MachineFunction::addCatchTypeInfo
void addCatchTypeInfo(MachineBasicBlock *LandingPad, ArrayRef< const GlobalValue * > TyInfo)
Provide the catch typeinfo for a landing pad.
Definition: MachineFunction.cpp:750
MCContext.h
llvm::TargetLoweringBase::getMinFunctionAlignment
Align getMinFunctionAlignment() const
Return the minimum function alignment.
Definition: TargetLowering.h:1753
llvm::DataLayout::getABIIntegerTypeAlignment
Align getABIIntegerTypeAlignment(unsigned BitWidth) const
Returns the minimum ABI-required alignment for an integer type of the specified bitwidth.
Definition: DataLayout.h:531
llvm::MachineFunction::DeleteMachineInstr
void DeleteMachineInstr(MachineInstr *MI)
DeleteMachineInstr - Delete the given MachineInstr.
Definition: MachineFunction.cpp:393
llvm::MachineJumpTableEntry::MBBs
std::vector< MachineBasicBlock * > MBBs
MBBs - The vector of basic blocks from which to create the jump table.
Definition: MachineJumpTableInfo.h:36
llvm::MachineFrameInfo::print
void print(const MachineFunction &MF, raw_ostream &OS) const
Used by the MachineFunction printer to print information about stack objects.
Definition: MachineFrameInfo.cpp:212
llvm::TargetRegisterClass
Definition: TargetRegisterInfo.h:46
llvm::MachineFunctionInfo::~MachineFunctionInfo
virtual ~MachineFunctionInfo()
MCSymbol.h
llvm::MachineFunction::getProperties
const MachineFunctionProperties & getProperties() const
Get the function properties.
Definition: MachineFunction.h:667
DenseSet.h
llvm::LandingPadInfo::TypeIds
std::vector< int > TypeIds
Definition: MachineFunction.h:224
PseudoSourceValue.h
llvm::MachineFunction::setDebugInstrNumberingCount
void setDebugInstrNumberingCount(unsigned Num)
Set value of DebugInstrNumberingCount field.
Definition: MachineFunction.cpp:948
llvm::MachineFunction::size
unsigned size() const
Definition: MachineFunction.h:768
llvm::MachineConstantPoolEntry::getSectionKind
SectionKind getSectionKind(const DataLayout *DL) const
Definition: MachineFunction.cpp:1126
llvm::MachineFunction::getTypeIDFor
unsigned getTypeIDFor(const GlobalValue *TI)
Return the type id for the specified typeinfo. This is function wide.
Definition: MachineFunction.cpp:841
llvm::MCInstrDesc
Describe properties that are true of each instruction in the target description file.
Definition: MCInstrDesc.h:195
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::MachineFunctionProperties::set
MachineFunctionProperties & set(Property P)
Definition: MachineFunction.h:169
llvm::Instruction
Definition: Instruction.h:45
llvm::MachineModuleInfo
This class contains meta information specific to a module.
Definition: MachineModuleInfo.h:78
llvm::MachineInstr::shouldUpdateCallSiteInfo
bool shouldUpdateCallSiteInfo() const
Return true if copying, moving, or erasing this instruction requires updating Call Site Info (see cop...
Definition: MachineInstr.cpp:720
llvm::TargetFrameLowering::isStackRealignable
bool isStackRealignable() const
isStackRealignable - This method returns whether the stack can be realigned.
Definition: TargetFrameLowering.h:122
llvm::MachineFunction::viewCFG
void viewCFG() const
viewCFG - This function is meant for use from the debugger.
Definition: MachineFunction.cpp:612
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:50
llvm::Function::hasPersonalityFn
bool hasPersonalityFn() const
Check whether this function has a personality function.
Definition: Function.h:830
llvm::MachineFunction::makeDebugValueSubstitution
void makeDebugValueSubstitution(DebugInstrOperandPair, DebugInstrOperandPair)
Create a substitution between one <instr,operand> value to a different, new value.
Definition: MachineFunction.cpp:952
llvm::MachineFunction::shouldSplitStack
bool shouldSplitStack() const
Should we be emitting segmented stack stuff for the function.
Definition: MachineFunction.cpp:280
BitVector.h
llvm::MachineFunction::begin
iterator begin()
Definition: MachineFunction.h:758
llvm::SlotIndexes
SlotIndexes pass.
Definition: SlotIndexes.h:314
llvm::BitVector::size_type
unsigned size_type
Definition: BitVector.h:88
llvm::MachineConstantPool::~MachineConstantPool
~MachineConstantPool()
Definition: MachineFunction.cpp:1143
llvm::MachineFunction::addFilterTypeInfo
void addFilterTypeInfo(MachineBasicBlock *LandingPad, ArrayRef< const GlobalValue * > TyInfo)
Provide the filter typeinfo for a landing pad.
Definition: MachineFunction.cpp:757
llvm::printJumpTableEntryReference
Printable printJumpTableEntryReference(unsigned Idx)
Prints a jump table entry reference.
Definition: MachineFunction.cpp:1099
llvm::MachineRegisterInfo::livein_begin
livein_iterator livein_begin() const
Definition: MachineRegisterInfo.h:952
CanShareConstantPoolEntry
static bool CanShareConstantPoolEntry(const Constant *A, const Constant *B, const DataLayout &DL)
Test whether the given two constants can be allocated the same constant pool entry.
Definition: MachineFunction.cpp:1160
Align
uint64_t Align
Definition: ELFObjHandler.cpp:83
llvm::BasicBlock::getFirstNonPHI
const Instruction * getFirstNonPHI() const
Returns a pointer to the first instruction in this block that is not a PHINode instruction.
Definition: BasicBlock.cpp:212
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
llvm::MachineMemOperand::getSyncScopeID
SyncScope::ID getSyncScopeID() const
Returns the synchronization scope ID for this memory operation.
Definition: MachineMemOperand.h:241
llvm::MachineFunction::tidyLandingPads
void tidyLandingPads(DenseMap< MCSymbol *, uintptr_t > *LPMap=nullptr, bool TidyIfNoBeginLabels=true)
Remap landing pad labels and remove any deleted landing pads.
Definition: MachineFunction.cpp:766
llvm::MachineFunction::addInvoke
void addInvoke(MachineBasicBlock *LandingPad, MCSymbol *BeginLabel, MCSymbol *EndLabel)
Provide the begin and end labels of an invoke style call and associate it with a try landing pad bloc...
Definition: MachineFunction.cpp:696
llvm::MCCFIInstruction
Definition: MCDwarf.h:441
getCallInstr
static const MachineInstr * getCallInstr(const MachineInstr *MI)
Return the call machine instruction or find a call within bundle.
Definition: MachineFunction.cpp:887
llvm::MachineBasicBlock
Definition: MachineBasicBlock.h:95
llvm::SmallString
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition: SmallString.h:25
llvm::MachineFunction::viewCFGOnly
void viewCFGOnly() const
viewCFGOnly - This function is meant for use from the debugger.
Definition: MachineFunction.cpp:622
llvm::MachineJumpTableInfo::EK_LabelDifference32
@ EK_LabelDifference32
EK_LabelDifference32 - Each entry is the address of the block minus the address of the jump table.
Definition: MachineJumpTableInfo.h:68
llvm::DOTGraphTraits
DOTGraphTraits - Template class that can be specialized to customize how graphs are converted to 'dot...
Definition: DOTGraphTraits.h:161
llvm::MachineRegisterInfo::getRegClass
const TargetRegisterClass * getRegClass(Register Reg) const
Return the register class of the specified virtual register.
Definition: MachineRegisterInfo.h:634
llvm::ARM_PROC::IE
@ IE
Definition: ARMBaseInfo.h:27
llvm::DOTGraphTraits< const MachineFunction * >::getGraphName
static std::string getGraphName(const MachineFunction *F)
Definition: MachineFunction.cpp:580
llvm::MachineFunction::getMMI
MachineModuleInfo & getMMI() const
Definition: MachineFunction.h:527
llvm::MachineFunction::deallocateOperandArray
void deallocateOperandArray(OperandCapacity Cap, MachineOperand *Array)
Dellocate an array of MachineOperands and recycle the memory.
Definition: MachineFunction.h:906
llvm::DenseSet
Implements a dense probed hash-table based set.
Definition: DenseSet.h:268
llvm::MachineFunction::getSubtarget
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Definition: MachineFunction.h:576
llvm::AtomicOrdering
AtomicOrdering
Atomic ordering for LLVM's memory model.
Definition: AtomicOrdering.h:56
BasicBlock.h
llvm::cl::opt
Definition: CommandLine.h:1422
llvm::ClrHandlerType::Filter
@ Filter
llvm::GlobalValue
Definition: GlobalValue.h:44
llvm::MachineJumpTableInfo::EK_GPRel64BlockAddress
@ EK_GPRel64BlockAddress
EK_GPRel64BlockAddress - Each entry is an address of block, encoded with a relocation as gp-relative,...
Definition: MachineJumpTableInfo.h:54
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
llvm::WinEHFuncInfo
Definition: WinEHFuncInfo.h:90
llvm::MachineConstantPoolValue::getSizeInBytes
virtual unsigned getSizeInBytes(const DataLayout &DL) const
Definition: MachineFunction.cpp:1109
llvm::LandingPadInfo::BeginLabels
SmallVector< MCSymbol *, 1 > BeginLabels
Definition: MachineFunction.h:220
llvm::MachineFunctionProperties::Property::TracksLiveness
@ TracksLiveness
llvm::MachineInstr
Representation of each machine instruction.
Definition: MachineInstr.h:64
llvm::MachineFunction::createMIExtraInfo
MachineInstr::ExtraInfo * createMIExtraInfo(ArrayRef< MachineMemOperand * > MMOs, MCSymbol *PreInstrSymbol=nullptr, MCSymbol *PostInstrSymbol=nullptr, MDNode *HeapAllocMarker=nullptr)
Allocate and construct an extra info structure for a MachineInstr.
Definition: MachineFunction.cpp:488
llvm::GlobalValue::getParent
Module * getParent()
Get the module that this global value is contained inside of...
Definition: GlobalValue.h:572
const
aarch64 promote const
Definition: AArch64PromoteConstant.cpp:232
llvm::MachineFunction::addSEHCleanupHandler
void addSEHCleanupHandler(MachineBasicBlock *LandingPad, const Function *Cleanup)
Definition: MachineFunction.cpp:827
llvm::MachineFunction::CloneMachineInstr
MachineInstr * CloneMachineInstr(const MachineInstr *Orig)
Create a new MachineInstr which is a copy of Orig, identical in all ways except the instruction has n...
Definition: MachineFunction.cpp:358
s
multiplies can be turned into SHL s
Definition: README.txt:370
llvm::MachinePointerInfo
This class contains a discriminated union of information about pointers in memory operands,...
Definition: MachineMemOperand.h:37
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::numbers::e
constexpr double e
Definition: MathExtras.h:57
llvm::DenseMap
Definition: DenseMap.h:714
llvm::SyncScope::ID
uint8_t ID
Definition: LLVMContext.h:47
llvm::MachineConstantPool
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
Definition: MachineConstantPool.h:117
llvm::MachineFunction::dump
void dump() const
dump - Print the current MachineFunction to cerr, useful for debugger use.
Definition: MachineFunction.cpp:517
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::isScopedEHPersonality
bool isScopedEHPersonality(EHPersonality Pers)
Returns true if this personality uses scope-style EH IR instructions: catchswitch,...
Definition: EHPersonalities.h:80
llvm::DenormalMode
Represent subnormal handling kind for floating point instruction inputs and outputs.
Definition: FloatingPointMode.h:67
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:443
MachineConstantPool.h
llvm::MachineJumpTableInfo::JTEntryKind
JTEntryKind
JTEntryKind - This enum indicates how each entry of the jump table is represented and emitted.
Definition: MachineJumpTableInfo.h:46
llvm::MachineFunction::CreateMachineBasicBlock
MachineBasicBlock * CreateMachineBasicBlock(const BasicBlock *bb=nullptr)
CreateMachineBasicBlock - Allocate a new MachineBasicBlock.
Definition: MachineFunction.cpp:414
llvm::MachineBasicBlock::setIsEndSection
void setIsEndSection(bool V=true)
Definition: MachineBasicBlock.h:571
llvm::DenseMapBase::find
iterator find(const_arg_type_t< KeyT > Val)
Definition: DenseMap.h:150
llvm::MachineMemOperand::Flags
Flags
Flags values. These may be or'd together.
Definition: MachineMemOperand.h:130
llvm::MachineFunction::getName
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
Definition: MachineFunction.cpp:522
llvm::TargetMachine::Options
TargetOptions Options
Definition: TargetMachine.h:115
llvm::MachineFunction::~MachineFunction
~MachineFunction()
Definition: MachineFunction.cpp:210
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::MachineConstantPoolEntry::isMachineConstantPoolEntry
bool isMachineConstantPoolEntry() const
isMachineConstantPoolEntry - Return true if the MachineConstantPoolEntry is indeed a target specific ...
Definition: MachineConstantPool.h:93
llvm::LandingPadInfo::LandingPadBlock
MachineBasicBlock * LandingPadBlock
Definition: MachineFunction.h:219
llvm::DataLayout::getPointerABIAlignment
Align getPointerABIAlignment(unsigned AS) const
Layout pointer alignment.
Definition: DataLayout.cpp:693
llvm::MachineBasicBlock::getParent
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
Definition: MachineBasicBlock.h:225
MachineModuleInfo.h
llvm::MachineFunction::DebugValueSubstitutions
std::map< DebugInstrOperandPair, DebugInstrOperandPair > DebugValueSubstitutions
Substitution map: from one <inst,operand> pair to another.
Definition: MachineFunction.h:458
llvm::MDNode
Metadata node.
Definition: Metadata.h:897
llvm::MachinePointerInfo::getWithOffset
MachinePointerInfo getWithOffset(int64_t O) const
Definition: MachineMemOperand.h:79
llvm::ArrayRecycler::clear
void clear(AllocatorType &Allocator)
Release all the tracked allocations to the allocator.
Definition: ArrayRecycler.h:104
llvm::MachineFunction
Definition: MachineFunction.h:230
llvm::MachineConstantPoolEntry::needsRelocation
bool needsRelocation() const
This method classifies the entry according to whether or not it may generate a relocation entry.
Definition: MachineFunction.cpp:1119
llvm::MachineFunction::addLiveIn
Register addLiveIn(MCRegister PReg, const TargetRegisterClass *RC)
addLiveIn - Add the specified physical register as a live-in value and create a corresponding virtual...
Definition: MachineFunction.cpp:634
llvm::sys::fs::remove
std::error_code remove(const Twine &path, bool IgnoreNonExisting=true)
Remove path.
llvm::BlockAddress
The address of a basic block.
Definition: Constants.h:847
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::MachineBasicBlock::getNumber
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
Definition: MachineBasicBlock.h:1060
llvm::MachinePointerInfo::V
PointerUnion< const Value *, const PseudoSourceValue * > V
This is the IR pointer value for the access, or it is null if unknown.
Definition: MachineMemOperand.h:41
llvm::min
Expected< ExpressionValue > min(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
Definition: FileCheck.cpp:357
DataLayout.h
llvm::MachineFunction::DeleteMachineBasicBlock
void DeleteMachineBasicBlock(MachineBasicBlock *MBB)
DeleteMachineBasicBlock - Delete the given MachineBasicBlock.
Definition: MachineFunction.cpp:421
llvm::MachineFunction::allocateShuffleMask
ArrayRef< int > allocateShuffleMask(ArrayRef< int > Mask)
Definition: MachineFunction.cpp:510
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
MBBI
MachineBasicBlock MachineBasicBlock::iterator MBBI
Definition: AArch64SLSHardening.cpp:75
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:136
A
* A
Definition: README_ALTIVEC.txt:89
getParent
static const Function * getParent(const Value *V)
Definition: BasicAliasAnalysis.cpp:767
uint32_t
Compiler.h
llvm::getBundleStart
MachineBasicBlock::instr_iterator getBundleStart(MachineBasicBlock::instr_iterator I)
Returns an iterator to the first instruction in the bundle containing I.
Definition: MachineInstrBundle.h:44
llvm::append_range
void append_range(Container &C, Range &&R)
Wrapper function to append a range to a container.
Definition: STLExtras.h:1672
llvm::ilist_node_impl::getIterator
self_iterator getIterator()
Definition: ilist_node.h:81
llvm::MachineJumpTableInfo::print
void print(raw_ostream &OS) const
print - Used by the MachineFunction printer to print information about jump tables.
Definition: MachineFunction.cpp:1079
TargetSubtargetInfo.h
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::MachineJumpTableInfo::ReplaceMBBInJumpTable
bool ReplaceMBBInJumpTable(unsigned Idx, MachineBasicBlock *Old, MachineBasicBlock *New)
ReplaceMBBInJumpTable - If Old is a target of the jump tables, update the jump table to branch to New...
Definition: MachineFunction.cpp:1065
llvm::MachineFunctionProperties::reset
MachineFunctionProperties & reset(Property P)
Definition: MachineFunction.h:174
llvm::Value::getName
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:294
llvm::MCContext::createTempSymbol
MCSymbol * createTempSymbol()
Create a temporary symbol with a unique name.
Definition: MCContext.cpp:297
llvm::TargetSubtargetInfo
TargetSubtargetInfo - Generic base class for all target subtargets.
Definition: TargetSubtargetInfo.h:59
llvm::MachineBasicBlock::getSectionID
MBBSectionID getSectionID() const
Returns the section ID of this basic block.
Definition: MachineBasicBlock.h:574
llvm::MachineFunction::DebugInstrNumberingCount
unsigned DebugInstrNumberingCount
A count of how many instructions in the function have had numbers assigned to them.
Definition: MachineFunction.h:445
llvm::Function::getDenormalMode
DenormalMode getDenormalMode(const fltSemantics &FPType) const
Returns the denormal handling type for the default rounding mode of the function.
Definition: Function.cpp:641
llvm::MachineFunction::CloneMachineInstrBundle
MachineInstr & CloneMachineInstrBundle(MachineBasicBlock &MBB, MachineBasicBlock::iterator InsertBefore, const MachineInstr &Orig)
Clones instruction or the whole instruction bundle Orig and insert into MBB before InsertBefore.
Definition: MachineFunction.cpp:363
MRI
unsigned const MachineRegisterInfo * MRI
Definition: AArch64AdvSIMDScalarPass.cpp:105
llvm::Value::stripPointerCasts
const Value * stripPointerCasts() const
Strip off pointer casts, all-zero GEPs and address space casts.
Definition: Value.cpp:662
llvm::Register
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
llvm::MachineFunction::getFilterIDFor
int getFilterIDFor(std::vector< unsigned > &TyIds)
Return the id of the filter encoded by TyIds. This is function wide.
Definition: MachineFunction.cpp:849
llvm::MachineBasicBlock::setNumber
void setNumber(int N)
Definition: MachineBasicBlock.h:1061
MBB
MachineBasicBlock & MBB
Definition: AArch64SLSHardening.cpp:74
Attributes.h
j
return j(j<< 16)
llvm::SectionKind::getMergeableConst8
static SectionKind getMergeableConst8()
Definition: SectionKind.h:196
Constant.h
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:80
llvm::commonAlignment
Align commonAlignment(Align A, Align B)
Returns the alignment that satisfies both alignments.
Definition: Alignment.h:211
llvm::SectionKind
SectionKind - This is a simple POD value that classifies the properties of a section.
Definition: SectionKind.h:22
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
GraphWriter.h
llvm::MachineFunction::getFunction
Function & getFunction()
Return the LLVM function that this machine code represents.
Definition: MachineFunction.h:542
llvm::TargetSubtargetInfo::getFrameLowering
virtual const TargetFrameLowering * getFrameLowering() const
Definition: TargetSubtargetInfo.h:93
llvm::MachineFunction::needsFrameMoves
bool needsFrameMoves() const
True if this function needs frame moves for debug or exceptions.
Definition: MachineFunction.cpp:568
llvm::MachineFunction::getTarget
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
Definition: MachineFunction.h:572
llvm::DenseMapBase::end
iterator end()
Definition: DenseMap.h:83
llvm::ArrayRef::begin
iterator begin() const
Definition: ArrayRef.h:153
llvm::MachineBasicBlock::insert
instr_iterator insert(instr_iterator I, MachineInstr *M)
Insert MI into the instruction list before I, possibly inside a bundle.
Definition: MachineBasicBlock.cpp:1338
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
WasmEHFuncInfo.h
llvm::MachineMemOperand::getSize
uint64_t getSize() const
Return the size in bytes of the memory reference.
Definition: MachineMemOperand.h:221
llvm::MachineJumpTableInfo::EK_Inline
@ EK_Inline
EK_Inline - Jump table entries are emitted inline at their point of use.
Definition: MachineJumpTableInfo.h:72
llvm::MachineBasicBlock::setIsBeginSection
void setIsBeginSection(bool V=true)
Definition: MachineBasicBlock.h:569
Casting.h
llvm::fltSemantics
Definition: APFloat.cpp:54
llvm::MachineRegisterInfo::livein_iterator
std::vector< std::pair< MCRegister, Register > >::const_iterator livein_iterator
Definition: MachineRegisterInfo.h:951
Function.h
llvm::MachineFunction::print
void print(raw_ostream &OS, const SlotIndexes *=nullptr) const
print - Print out the MachineFunction in a format suitable for debugging to the specified stream.
Definition: MachineFunction.cpp:526
llvm::MachineJumpTableEntry
MachineJumpTableEntry - One jump table in the jump table info.
Definition: MachineJumpTableInfo.h:34
DOTGraphTraits.h
LLVM_NODISCARD
#define LLVM_NODISCARD
LLVM_NODISCARD - Warn if a type or return value is discarded.
Definition: Compiler.h:161
llvm::Function::needsUnwindTableEntry
bool needsUnwindTableEntry() const
True if this function needs an unwind table.
Definition: Function.h:688
llvm::MachineConstantPoolEntry::Val
union llvm::MachineConstantPoolEntry::@177 Val
The constant itself.
llvm::LLVMTargetMachine
This class describes a target machine that is implemented with the LLVM target-independent code gener...
Definition: TargetMachine.h:385
llvm::SmallVectorImpl::clear
void clear()
Definition: SmallVector.h:584
llvm::MachineFunction::MachineFunction
MachineFunction(Function &F, const LLVMTargetMachine &Target, const TargetSubtargetInfo &STI, unsigned FunctionNum, MachineModuleInfo &MMI)
Definition: MachineFunction.cpp:137
isSimple
static bool isSimple(Instruction *I)
Definition: SLPVectorizer.cpp:525
llvm::Function::getPersonalityFn
Constant * getPersonalityFn() const
Get the personality function associated with this function.
Definition: Function.cpp:1743
SectionKind.h
llvm::MachineFunction::addCleanup
void addCleanup(MachineBasicBlock *LandingPad)
Add a cleanup action for a landing pad.
Definition: MachineFunction.cpp:812
llvm::MachineConstantPool::print
void print(raw_ostream &OS) const
print - Used by the MachineFunction printer to print information about constant pool objects.
Definition: MachineFunction.cpp:1239
llvm::getAlign
bool getAlign(const Function &F, unsigned index, unsigned &align)
Definition: NVPTXUtilities.cpp:284
WinEHFuncInfo.h
llvm::MachineFunction::getPICBaseSymbol
MCSymbol * getPICBaseSymbol() const
getPICBaseSymbol - Return a function-local symbol to represent the PIC base.
Definition: MachineFunction.cpp:674
llvm::SEHHandler
Definition: MachineFunction.h:209
llvm::MachineFunction::addFrameInst
LLVM_NODISCARD unsigned addFrameInst(const MCCFIInstruction &Inst)
Definition: MachineFunction.cpp:285
llvm::MachineFrameInfo
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
Definition: MachineFrameInfo.h:107
Instructions.h
llvm::TargetSubtargetInfo::getTargetLowering
virtual const TargetLowering * getTargetLowering() const
Definition: TargetSubtargetInfo.h:96
SmallVector.h
llvm::ilist_alloc_traits::deleteNode
static void deleteNode(NodeTy *V)
Definition: ilist.h:41
llvm::MachineConstantPoolValue::getExistingMachineCPValue
virtual int getExistingMachineCPValue(MachineConstantPool *CP, Align Alignment)=0
llvm::Printable
Simple wrapper around std::function<void(raw_ostream&)>.
Definition: Printable.h:37
llvm::MachineModuleInfo::addPersonality
void addPersonality(const Function *Personality)
Provide the personality function for the exception information.
Definition: MachineModuleInfo.cpp:278
llvm::SectionKind::getMergeableConst4
static SectionKind getMergeableConst4()
Definition: SectionKind.h:195
N
#define N
llvm::MachineInstr::getNumOperands
unsigned getNumOperands() const
Retuns the total number of operands.
Definition: MachineInstr.h:481
llvm::ArrayRef::size
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:165
llvm::max
Align max(MaybeAlign Lhs, Align Rhs)
Definition: Alignment.h:340
llvm::MachineFunction::getDataLayout
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
Definition: MachineFunction.cpp:260
llvm::raw_svector_ostream
A raw_ostream that writes to an SmallVector or SmallString.
Definition: raw_ostream.h:647
llvm::MachineJumpTableInfo::EK_GPRel32BlockAddress
@ EK_GPRel32BlockAddress
EK_GPRel32BlockAddress - Each entry is an address of block, encoded with a relocation as gp-relative,...
Definition: MachineJumpTableInfo.h:59
ModuleSlotTracker.h
MachineMemOperand.h
llvm::DefaultDOTGraphTraits
DefaultDOTGraphTraits - This class provides the default implementations of all of the DOTGraphTraits ...
Definition: DOTGraphTraits.h:28
llvm::MachineMemOperand::getFailureOrdering
AtomicOrdering getFailureOrdering() const
For cmpxchg atomic operations, return the atomic ordering requirements when store does not occur.
Definition: MachineMemOperand.h:254
llvm::Module::getDataLayout
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
Definition: Module.cpp:397
DerivedTypes.h
llvm::LandingPadInfo
This structure is used to retain landing pad info for the current function.
Definition: MachineFunction.h:218
llvm::IntegerType::get
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
Definition: Type.cpp:269
llvm::TargetRegisterClass::hasSubClassEq
bool hasSubClassEq(const TargetRegisterClass *RC) const
Returns true if RC is a sub-class of or equal to this class.
Definition: TargetRegisterInfo.h:124
BB
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
Definition: README.txt:39
llvm::MachineFunction::createExternalSymbolName
const char * createExternalSymbolName(StringRef Name)
Allocate a string and populate it with the given external symbol name.
Definition: MachineFunction.cpp:495
llvm::MachineJumpTableInfo::getEntryAlignment
unsigned getEntryAlignment(const DataLayout &TD) const
getEntryAlignment - Return the alignment of each entry in the jump table.
Definition: MachineFunction.cpp:1014
llvm::MachineMemOperand::getOrdering
AtomicOrdering getOrdering() const
Return the atomic ordering requirements for this memory operation.
Definition: MachineMemOperand.h:248
llvm::MachineFunction::CreateMachineInstr
MachineInstr * CreateMachineInstr(const MCInstrDesc &MCID, const DebugLoc &DL, bool NoImplicit=false)
CreateMachineInstr - Allocate a new MachineInstr.
Definition: MachineFunction.cpp:348
llvm::DebugLoc
A debug info location.
Definition: DebugLoc.h:33
llvm::MachineFunction::addLandingPad
MCSymbol * addLandingPad(MachineBasicBlock *LandingPad)
Add a new panding pad, and extract the exception handling information from the landingpad instruction...
Definition: MachineFunction.cpp:703
llvm::cl::desc
Definition: CommandLine.h:414
llvm::MachineJumpTableInfo
Definition: MachineJumpTableInfo.h:42
llvm::SectionKind::getMergeableConst32
static SectionKind getMergeableConst32()
Definition: SectionKind.h:198
raw_ostream.h
llvm::MachineMemOperand::getRanges
const MDNode * getRanges() const
Return the range tag for the memory reference.
Definition: MachineMemOperand.h:238
llvm::MachineConstantPool::dump
void dump() const
dump - Call print(cerr) to be called from the debugger.
Definition: MachineFunction.cpp:1255
llvm::MachineFunction::empty
bool empty() const
Definition: MachineFunction.h:769
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::MachineFunction::eraseCallSiteInfo
void eraseCallSiteInfo(const MachineInstr *MI)
Following functions update call site info.
Definition: MachineFunction.cpp:899
llvm::MachineFunction::VariableDbgInfos
VariableDbgInfoMapTy VariableDbgInfos
Definition: MachineFunction.h:440
llvm::MachineInstrBundleIterator< MachineInstr >
Value.h
llvm::MachineRegisterInfo::livein_end
livein_iterator livein_end() const
Definition: MachineRegisterInfo.h:953
llvm::SEHHandler::RecoverBA
const BlockAddress * RecoverBA
Address of block to recover at. Null for a finally handler.
Definition: MachineFunction.h:214
llvm::DOTGraphTraits< const MachineFunction * >::DOTGraphTraits
DOTGraphTraits(bool isSimple=false)
Definition: MachineFunction.cpp:578
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
llvm::MachineMemOperand::getFlags
Flags getFlags() const
Return the raw flags of the source value,.
Definition: MachineMemOperand.h:209
TargetRegisterInfo.h
Debug.h
llvm::BumpPtrAllocatorImpl::Deallocate
void Deallocate(const void *Ptr, size_t Size, size_t)
Definition: Allocator.h:213
llvm::MachineFunction::RenumberBlocks
void RenumberBlocks(MachineBasicBlock *MBBFrom=nullptr)
RenumberBlocks - This discards all of the MachineBasicBlock numbers and recomputes them.
Definition: MachineFunction.cpp:294
llvm::ArrayRef::end
iterator end() const
Definition: ArrayRef.h:154
llvm::MachineFunction::getOrCreateLandingPadInfo
LandingPadInfo & getOrCreateLandingPadInfo(MachineBasicBlock *LandingPad)
Find or create an LandingPadInfo for the specified MachineBasicBlock.
Definition: MachineFunction.cpp:684
llvm::isFuncletEHPersonality
bool isFuncletEHPersonality(EHPersonality Pers)
Returns true if this is a personality function that invokes handler funclets (which must return to it...
Definition: EHPersonalities.h:65
llvm::DataLayout::getPointerSize
unsigned getPointerSize(unsigned AS=0) const
Layout pointer size FIXME: The defaults need to be removed once all of the backends/clients are updat...
Definition: DataLayout.cpp:701
llvm::MachineConstantPoolEntry::getSizeInBytes
unsigned getSizeInBytes(const DataLayout &DL) const
Definition: MachineFunction.cpp:1113
llvm::Use
A Use represents the edge between a Value definition and its users.
Definition: Use.h:44
llvm::MCRegister
Wrapper class representing physical registers. Should be passed by value.
Definition: MCRegister.h:23
llvm::MachineMemOperand::getPseudoValue
const PseudoSourceValue * getPseudoValue() const
Definition: MachineMemOperand.h:202
llvm::MachineFunction::Delegate::MF_HandleInsertion
virtual void MF_HandleInsertion(MachineInstr &MI)=0
Callback after an insertion. This should not modify the MI directly.