LLVM  3.7.0
MachineFunction.cpp
Go to the documentation of this file.
1 //===-- MachineFunction.cpp -----------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Collect native machine code information for a function. This allows
11 // target-specific information about the generated code to be stored with each
12 // function.
13 //
14 //===----------------------------------------------------------------------===//
15 
17 #include "llvm/ADT/STLExtras.h"
18 #include "llvm/ADT/SmallString.h"
28 #include "llvm/CodeGen/Passes.h"
29 #include "llvm/IR/DataLayout.h"
30 #include "llvm/IR/DebugInfo.h"
31 #include "llvm/IR/Function.h"
32 #include "llvm/IR/Module.h"
34 #include "llvm/MC/MCAsmInfo.h"
35 #include "llvm/MC/MCContext.h"
36 #include "llvm/Support/Debug.h"
43 using namespace llvm;
44 
45 #define DEBUG_TYPE "codegen"
46 
47 void MachineFunctionInitializer::anchor() {}
48 
49 //===----------------------------------------------------------------------===//
50 // MachineFunction implementation
51 //===----------------------------------------------------------------------===//
52 
53 // Out-of-line virtual method.
55 
58 }
59 
60 MachineFunction::MachineFunction(const Function *F, const TargetMachine &TM,
61  unsigned FunctionNum, MachineModuleInfo &mmi)
62  : Fn(F), Target(TM), STI(TM.getSubtargetImpl(*F)), Ctx(mmi.getContext()),
63  MMI(mmi) {
64  if (STI->getRegisterInfo())
65  RegInfo = new (Allocator) MachineRegisterInfo(this);
66  else
67  RegInfo = nullptr;
68 
69  MFInfo = nullptr;
70  FrameInfo = new (Allocator)
73  !F->hasFnAttribute("no-realign-stack"));
74 
76  FrameInfo->ensureMaxAlignment(Fn->getFnStackAlignment());
77 
78  ConstantPool = new (Allocator) MachineConstantPool(getDataLayout());
79  Alignment = STI->getTargetLowering()->getMinFunctionAlignment();
80 
81  // FIXME: Shouldn't use pref alignment if explicit alignment is set on Fn.
83  Alignment = std::max(Alignment,
85 
86  FunctionNumber = FunctionNum;
87  JumpTableInfo = nullptr;
88 }
89 
91  // Don't call destructors on MachineInstr and MachineOperand. All of their
92  // memory comes from the BumpPtrAllocator which is about to be purged.
93  //
94  // Do call MachineBasicBlock destructors, it contains std::vectors.
95  for (iterator I = begin(), E = end(); I != E; I = BasicBlocks.erase(I))
96  I->Insts.clearAndLeakNodesUnsafely();
97 
98  InstructionRecycler.clear(Allocator);
99  OperandRecycler.clear(Allocator);
100  BasicBlockRecycler.clear(Allocator);
101  if (RegInfo) {
102  RegInfo->~MachineRegisterInfo();
103  Allocator.Deallocate(RegInfo);
104  }
105  if (MFInfo) {
106  MFInfo->~MachineFunctionInfo();
107  Allocator.Deallocate(MFInfo);
108  }
109 
110  FrameInfo->~MachineFrameInfo();
111  Allocator.Deallocate(FrameInfo);
112 
113  ConstantPool->~MachineConstantPool();
114  Allocator.Deallocate(ConstantPool);
115 
116  if (JumpTableInfo) {
117  JumpTableInfo->~MachineJumpTableInfo();
118  Allocator.Deallocate(JumpTableInfo);
119  }
120 }
121 
123  return Fn->getParent()->getDataLayout();
124 }
125 
126 /// Get the JumpTableInfo for this function.
127 /// If it does not already exist, allocate one.
129 getOrCreateJumpTableInfo(unsigned EntryKind) {
130  if (JumpTableInfo) return JumpTableInfo;
131 
132  JumpTableInfo = new (Allocator)
134  return JumpTableInfo;
135 }
136 
137 /// Should we be emitting segmented stack stuff for the function
139  return getFunction()->hasFnAttribute("split-stack");
140 }
141 
142 /// This discards all of the MachineBasicBlock numbers and recomputes them.
143 /// This guarantees that the MBB numbers are sequential, dense, and match the
144 /// ordering of the blocks within the function. If a specific MachineBasicBlock
145 /// is specified, only that block and those after it are renumbered.
147  if (empty()) { MBBNumbering.clear(); return; }
148  MachineFunction::iterator MBBI, E = end();
149  if (MBB == nullptr)
150  MBBI = begin();
151  else
152  MBBI = MBB;
153 
154  // Figure out the block number this should have.
155  unsigned BlockNo = 0;
156  if (MBBI != begin())
157  BlockNo = std::prev(MBBI)->getNumber() + 1;
158 
159  for (; MBBI != E; ++MBBI, ++BlockNo) {
160  if (MBBI->getNumber() != (int)BlockNo) {
161  // Remove use of the old number.
162  if (MBBI->getNumber() != -1) {
163  assert(MBBNumbering[MBBI->getNumber()] == &*MBBI &&
164  "MBB number mismatch!");
165  MBBNumbering[MBBI->getNumber()] = nullptr;
166  }
167 
168  // If BlockNo is already taken, set that block's number to -1.
169  if (MBBNumbering[BlockNo])
170  MBBNumbering[BlockNo]->setNumber(-1);
171 
172  MBBNumbering[BlockNo] = MBBI;
173  MBBI->setNumber(BlockNo);
174  }
175  }
176 
177  // Okay, all the blocks are renumbered. If we have compactified the block
178  // numbering, shrink MBBNumbering now.
179  assert(BlockNo <= MBBNumbering.size() && "Mismatch!");
180  MBBNumbering.resize(BlockNo);
181 }
182 
183 /// Allocate a new MachineInstr. Use this instead of `new MachineInstr'.
184 MachineInstr *
186  DebugLoc DL, bool NoImp) {
187  return new (InstructionRecycler.Allocate<MachineInstr>(Allocator))
188  MachineInstr(*this, MCID, DL, NoImp);
189 }
190 
191 /// Create a new MachineInstr which is a copy of the 'Orig' instruction,
192 /// identical in all ways except the instruction has no parent, prev, or next.
193 MachineInstr *
195  return new (InstructionRecycler.Allocate<MachineInstr>(Allocator))
196  MachineInstr(*this, *Orig);
197 }
198 
199 /// Delete the given MachineInstr.
200 ///
201 /// This function also serves as the MachineInstr destructor - the real
202 /// ~MachineInstr() destructor must be empty.
203 void
205  // Strip it for parts. The operand array and the MI object itself are
206  // independently recyclable.
207  if (MI->Operands)
208  deallocateOperandArray(MI->CapOperands, MI->Operands);
209  // Don't call ~MachineInstr() which must be trivial anyway because
210  // ~MachineFunction drops whole lists of MachineInstrs wihout calling their
211  // destructors.
212  InstructionRecycler.Deallocate(Allocator, MI);
213 }
214 
215 /// Allocate a new MachineBasicBlock. Use this instead of
216 /// `new MachineBasicBlock'.
219  return new (BasicBlockRecycler.Allocate<MachineBasicBlock>(Allocator))
220  MachineBasicBlock(*this, bb);
221 }
222 
223 /// Delete the given MachineBasicBlock.
224 void
226  assert(MBB->getParent() == this && "MBB parent mismatch!");
227  MBB->~MachineBasicBlock();
228  BasicBlockRecycler.Deallocate(Allocator, MBB);
229 }
230 
233  uint64_t s, unsigned base_alignment,
234  const AAMDNodes &AAInfo,
235  const MDNode *Ranges) {
236  return new (Allocator) MachineMemOperand(PtrInfo, f, s, base_alignment,
237  AAInfo, Ranges);
238 }
239 
242  int64_t Offset, uint64_t Size) {
243  if (MMO->getValue())
244  return new (Allocator)
246  MMO->getOffset()+Offset),
247  MMO->getFlags(), Size,
248  MMO->getBaseAlignment());
249  return new (Allocator)
251  MMO->getOffset()+Offset),
252  MMO->getFlags(), Size,
253  MMO->getBaseAlignment());
254 }
255 
258  return Allocator.Allocate<MachineMemOperand *>(Num);
259 }
260 
261 std::pair<MachineInstr::mmo_iterator, MachineInstr::mmo_iterator>
264  // Count the number of load mem refs.
265  unsigned Num = 0;
266  for (MachineInstr::mmo_iterator I = Begin; I != End; ++I)
267  if ((*I)->isLoad())
268  ++Num;
269 
270  // Allocate a new array and populate it with the load information.
272  unsigned Index = 0;
273  for (MachineInstr::mmo_iterator I = Begin; I != End; ++I) {
274  if ((*I)->isLoad()) {
275  if (!(*I)->isStore())
276  // Reuse the MMO.
277  Result[Index] = *I;
278  else {
279  // Clone the MMO and unset the store flag.
280  MachineMemOperand *JustLoad =
281  getMachineMemOperand((*I)->getPointerInfo(),
282  (*I)->getFlags() & ~MachineMemOperand::MOStore,
283  (*I)->getSize(), (*I)->getBaseAlignment(),
284  (*I)->getAAInfo());
285  Result[Index] = JustLoad;
286  }
287  ++Index;
288  }
289  }
290  return std::make_pair(Result, Result + Num);
291 }
292 
293 std::pair<MachineInstr::mmo_iterator, MachineInstr::mmo_iterator>
296  // Count the number of load mem refs.
297  unsigned Num = 0;
298  for (MachineInstr::mmo_iterator I = Begin; I != End; ++I)
299  if ((*I)->isStore())
300  ++Num;
301 
302  // Allocate a new array and populate it with the store information.
304  unsigned Index = 0;
305  for (MachineInstr::mmo_iterator I = Begin; I != End; ++I) {
306  if ((*I)->isStore()) {
307  if (!(*I)->isLoad())
308  // Reuse the MMO.
309  Result[Index] = *I;
310  else {
311  // Clone the MMO and unset the load flag.
312  MachineMemOperand *JustStore =
313  getMachineMemOperand((*I)->getPointerInfo(),
314  (*I)->getFlags() & ~MachineMemOperand::MOLoad,
315  (*I)->getSize(), (*I)->getBaseAlignment(),
316  (*I)->getAAInfo());
317  Result[Index] = JustStore;
318  }
319  ++Index;
320  }
321  }
322  return std::make_pair(Result, Result + Num);
323 }
324 
325 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
326 void MachineFunction::dump() const {
327  print(dbgs());
328 }
329 #endif
330 
332  assert(getFunction() && "No function!");
333  return getFunction()->getName();
334 }
335 
336 void MachineFunction::print(raw_ostream &OS, SlotIndexes *Indexes) const {
337  OS << "# Machine code for function " << getName() << ": ";
338  if (RegInfo) {
339  OS << (RegInfo->isSSA() ? "SSA" : "Post SSA");
340  if (!RegInfo->tracksLiveness())
341  OS << ", not tracking liveness";
342  }
343  OS << '\n';
344 
345  // Print Frame Information
346  FrameInfo->print(*this, OS);
347 
348  // Print JumpTable Information
349  if (JumpTableInfo)
350  JumpTableInfo->print(OS);
351 
352  // Print Constant Pool
353  ConstantPool->print(OS);
354 
356 
357  if (RegInfo && !RegInfo->livein_empty()) {
358  OS << "Function Live Ins: ";
360  I = RegInfo->livein_begin(), E = RegInfo->livein_end(); I != E; ++I) {
361  OS << PrintReg(I->first, TRI);
362  if (I->second)
363  OS << " in " << PrintReg(I->second, TRI);
364  if (std::next(I) != E)
365  OS << ", ";
366  }
367  OS << '\n';
368  }
369 
372  for (const auto &BB : *this) {
373  OS << '\n';
374  BB.print(OS, MST, Indexes);
375  }
376 
377  OS << "\n# End machine code for function " << getName() << ".\n\n";
378 }
379 
380 namespace llvm {
381  template<>
383 
384  DOTGraphTraits (bool isSimple=false) : DefaultDOTGraphTraits(isSimple) {}
385 
386  static std::string getGraphName(const MachineFunction *F) {
387  return ("CFG for '" + F->getName() + "' function").str();
388  }
389 
390  std::string getNodeLabel(const MachineBasicBlock *Node,
391  const MachineFunction *Graph) {
392  std::string OutStr;
393  {
394  raw_string_ostream OSS(OutStr);
395 
396  if (isSimple()) {
397  OSS << "BB#" << Node->getNumber();
398  if (const BasicBlock *BB = Node->getBasicBlock())
399  OSS << ": " << BB->getName();
400  } else
401  Node->print(OSS);
402  }
403 
404  if (OutStr[0] == '\n') OutStr.erase(OutStr.begin());
405 
406  // Process string output to make it nicer...
407  for (unsigned i = 0; i != OutStr.length(); ++i)
408  if (OutStr[i] == '\n') { // Left justify
409  OutStr[i] = '\\';
410  OutStr.insert(OutStr.begin()+i+1, 'l');
411  }
412  return OutStr;
413  }
414  };
415 }
416 
418 {
419 #ifndef NDEBUG
420  ViewGraph(this, "mf" + getName());
421 #else
422  errs() << "MachineFunction::viewCFG is only available in debug builds on "
423  << "systems with Graphviz or gv!\n";
424 #endif // NDEBUG
425 }
426 
428 {
429 #ifndef NDEBUG
430  ViewGraph(this, "mf" + getName(), true);
431 #else
432  errs() << "MachineFunction::viewCFGOnly is only available in debug builds on "
433  << "systems with Graphviz or gv!\n";
434 #endif // NDEBUG
435 }
436 
437 /// Add the specified physical register as a live-in value and
438 /// create a corresponding virtual register for it.
439 unsigned MachineFunction::addLiveIn(unsigned PReg,
440  const TargetRegisterClass *RC) {
442  unsigned VReg = MRI.getLiveInVirtReg(PReg);
443  if (VReg) {
444  const TargetRegisterClass *VRegRC = MRI.getRegClass(VReg);
445  (void)VRegRC;
446  // A physical register can be added several times.
447  // Between two calls, the register class of the related virtual register
448  // may have been constrained to match some operation constraints.
449  // In that case, check that the current register class includes the
450  // physical register and is a sub class of the specified RC.
451  assert((VRegRC == RC || (VRegRC->contains(PReg) &&
452  RC->hasSubClassEq(VRegRC))) &&
453  "Register class mismatch!");
454  return VReg;
455  }
456  VReg = MRI.createVirtualRegister(RC);
457  MRI.addLiveIn(PReg, VReg);
458  return VReg;
459 }
460 
461 /// Return the MCSymbol for the specified non-empty jump table.
462 /// If isLinkerPrivate is specified, an 'l' label is returned, otherwise a
463 /// normal 'L' label is returned.
465  bool isLinkerPrivate) const {
466  const DataLayout &DL = getDataLayout();
467  assert(JumpTableInfo && "No jump tables");
468  assert(JTI < JumpTableInfo->getJumpTables().size() && "Invalid JTI!");
469 
470  const char *Prefix = isLinkerPrivate ? DL.getLinkerPrivateGlobalPrefix()
471  : DL.getPrivateGlobalPrefix();
473  raw_svector_ostream(Name)
474  << Prefix << "JTI" << getFunctionNumber() << '_' << JTI;
475  return Ctx.getOrCreateSymbol(Name);
476 }
477 
478 /// Return a function-local symbol to represent the PIC base.
480  const DataLayout &DL = getDataLayout();
482  Twine(getFunctionNumber()) + "$pb");
483 }
484 
485 //===----------------------------------------------------------------------===//
486 // MachineFrameInfo implementation
487 //===----------------------------------------------------------------------===//
488 
489 /// Make sure the function is at least Align bytes aligned.
491  if (!StackRealignable || !RealignOption)
492  assert(Align <= StackAlignment &&
493  "For targets without stack realignment, Align is out of limit!");
494  if (MaxAlignment < Align) MaxAlignment = Align;
495 }
496 
497 /// Clamp the alignment if requested and emit a warning.
498 static inline unsigned clampStackAlignment(bool ShouldClamp, unsigned Align,
499  unsigned StackAlign) {
500  if (!ShouldClamp || Align <= StackAlign)
501  return Align;
502  DEBUG(dbgs() << "Warning: requested alignment " << Align
503  << " exceeds the stack alignment " << StackAlign
504  << " when stack realignment is off" << '\n');
505  return StackAlign;
506 }
507 
508 /// Create a new statically sized stack object, returning a nonnegative
509 /// identifier to represent it.
510 int MachineFrameInfo::CreateStackObject(uint64_t Size, unsigned Alignment,
511  bool isSS, const AllocaInst *Alloca) {
512  assert(Size != 0 && "Cannot allocate zero size stack objects!");
513  Alignment = clampStackAlignment(!StackRealignable || !RealignOption,
514  Alignment, StackAlignment);
515  Objects.push_back(StackObject(Size, Alignment, 0, false, isSS, Alloca,
516  !isSS));
517  int Index = (int)Objects.size() - NumFixedObjects - 1;
518  assert(Index >= 0 && "Bad frame index!");
519  ensureMaxAlignment(Alignment);
520  return Index;
521 }
522 
523 /// Create a new statically sized stack object that represents a spill slot,
524 /// returning a nonnegative identifier to represent it.
526  unsigned Alignment) {
527  Alignment = clampStackAlignment(!StackRealignable || !RealignOption,
528  Alignment, StackAlignment);
529  CreateStackObject(Size, Alignment, true);
530  int Index = (int)Objects.size() - NumFixedObjects - 1;
531  ensureMaxAlignment(Alignment);
532  return Index;
533 }
534 
535 /// Notify the MachineFrameInfo object that a variable sized object has been
536 /// created. This must be created whenever a variable sized object is created,
537 /// whether or not the index returned is actually used.
539  const AllocaInst *Alloca) {
540  HasVarSizedObjects = true;
541  Alignment = clampStackAlignment(!StackRealignable || !RealignOption,
542  Alignment, StackAlignment);
543  Objects.push_back(StackObject(0, Alignment, 0, false, false, Alloca, true));
544  ensureMaxAlignment(Alignment);
545  return (int)Objects.size()-NumFixedObjects-1;
546 }
547 
548 /// Create a new object at a fixed location on the stack.
549 /// All fixed objects should be created before other objects are created for
550 /// efficiency. By default, fixed objects are immutable. This returns an
551 /// index with a negative value.
552 int MachineFrameInfo::CreateFixedObject(uint64_t Size, int64_t SPOffset,
553  bool Immutable, bool isAliased) {
554  assert(Size != 0 && "Cannot allocate zero size fixed stack objects!");
555  // The alignment of the frame index can be determined from its offset from
556  // the incoming frame position. If the frame object is at offset 32 and
557  // the stack is guaranteed to be 16-byte aligned, then we know that the
558  // object is 16-byte aligned.
559  unsigned Align = MinAlign(SPOffset, StackAlignment);
560  Align = clampStackAlignment(!StackRealignable || !RealignOption, Align,
561  StackAlignment);
562  Objects.insert(Objects.begin(), StackObject(Size, Align, SPOffset, Immutable,
563  /*isSS*/ false,
564  /*Alloca*/ nullptr, isAliased));
565  return -++NumFixedObjects;
566 }
567 
568 /// Create a spill slot at a fixed location on the stack.
569 /// Returns an index with a negative value.
571  int64_t SPOffset) {
572  unsigned Align = MinAlign(SPOffset, StackAlignment);
573  Align = clampStackAlignment(!StackRealignable || !RealignOption, Align,
574  StackAlignment);
575  Objects.insert(Objects.begin(), StackObject(Size, Align, SPOffset,
576  /*Immutable*/ true,
577  /*isSS*/ true,
578  /*Alloca*/ nullptr,
579  /*isAliased*/ false));
580  return -++NumFixedObjects;
581 }
582 
584  const TargetRegisterInfo *TRI = MF.getSubtarget().getRegisterInfo();
585  BitVector BV(TRI->getNumRegs());
586 
587  // Before CSI is calculated, no registers are considered pristine. They can be
588  // freely used and PEI will make sure they are saved.
589  if (!isCalleeSavedInfoValid())
590  return BV;
591 
592  for (const MCPhysReg *CSR = TRI->getCalleeSavedRegs(&MF); CSR && *CSR; ++CSR)
593  BV.set(*CSR);
594 
595  // Saved CSRs are not pristine.
596  const std::vector<CalleeSavedInfo> &CSI = getCalleeSavedInfo();
597  for (std::vector<CalleeSavedInfo>::const_iterator I = CSI.begin(),
598  E = CSI.end(); I != E; ++I)
599  BV.reset(I->getReg());
600 
601  return BV;
602 }
603 
606  const TargetRegisterInfo *RegInfo = MF.getSubtarget().getRegisterInfo();
607  unsigned MaxAlign = getMaxAlignment();
608  int Offset = 0;
609 
610  // This code is very, very similar to PEI::calculateFrameObjectOffsets().
611  // It really should be refactored to share code. Until then, changes
612  // should keep in mind that there's tight coupling between the two.
613 
614  for (int i = getObjectIndexBegin(); i != 0; ++i) {
615  int FixedOff = -getObjectOffset(i);
616  if (FixedOff > Offset) Offset = FixedOff;
617  }
618  for (unsigned i = 0, e = getObjectIndexEnd(); i != e; ++i) {
619  if (isDeadObjectIndex(i))
620  continue;
621  Offset += getObjectSize(i);
622  unsigned Align = getObjectAlignment(i);
623  // Adjust to alignment boundary
624  Offset = (Offset+Align-1)/Align*Align;
625 
626  MaxAlign = std::max(Align, MaxAlign);
627  }
628 
629  if (adjustsStack() && TFI->hasReservedCallFrame(MF))
630  Offset += getMaxCallFrameSize();
631 
632  // Round up the size to a multiple of the alignment. If the function has
633  // any calls or alloca's, align to the target's StackAlignment value to
634  // ensure that the callee's frame or the alloca data is suitably aligned;
635  // otherwise, for leaf functions, align to the TransientStackAlignment
636  // value.
637  unsigned StackAlign;
638  if (adjustsStack() || hasVarSizedObjects() ||
639  (RegInfo->needsStackRealignment(MF) && getObjectIndexEnd() != 0))
640  StackAlign = TFI->getStackAlignment();
641  else
642  StackAlign = TFI->getTransientStackAlignment();
643 
644  // If the frame pointer is eliminated, all frame offsets will be relative to
645  // SP not FP. Align to MaxAlign so this works.
646  StackAlign = std::max(StackAlign, MaxAlign);
647  unsigned AlignMask = StackAlign - 1;
648  Offset = (Offset + AlignMask) & ~uint64_t(AlignMask);
649 
650  return (unsigned)Offset;
651 }
652 
654  if (Objects.empty()) return;
655 
657  int ValOffset = (FI ? FI->getOffsetOfLocalArea() : 0);
658 
659  OS << "Frame Objects:\n";
660 
661  for (unsigned i = 0, e = Objects.size(); i != e; ++i) {
662  const StackObject &SO = Objects[i];
663  OS << " fi#" << (int)(i-NumFixedObjects) << ": ";
664  if (SO.Size == ~0ULL) {
665  OS << "dead\n";
666  continue;
667  }
668  if (SO.Size == 0)
669  OS << "variable sized";
670  else
671  OS << "size=" << SO.Size;
672  OS << ", align=" << SO.Alignment;
673 
674  if (i < NumFixedObjects)
675  OS << ", fixed";
676  if (i < NumFixedObjects || SO.SPOffset != -1) {
677  int64_t Off = SO.SPOffset - ValOffset;
678  OS << ", at location [SP";
679  if (Off > 0)
680  OS << "+" << Off;
681  else if (Off < 0)
682  OS << Off;
683  OS << "]";
684  }
685  OS << "\n";
686  }
687 }
688 
689 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
691  print(MF, dbgs());
692 }
693 #endif
694 
695 //===----------------------------------------------------------------------===//
696 // MachineJumpTableInfo implementation
697 //===----------------------------------------------------------------------===//
698 
699 /// Return the size of each entry in the jump table.
701  // The size of a jump table entry is 4 bytes unless the entry is just the
702  // address of a block, in which case it is the pointer size.
703  switch (getEntryKind()) {
705  return TD.getPointerSize();
707  return 8;
711  return 4;
713  return 0;
714  }
715  llvm_unreachable("Unknown jump table encoding!");
716 }
717 
718 /// Return the alignment of each entry in the jump table.
720  // The alignment of a jump table entry is the alignment of int32 unless the
721  // entry is just the address of a block, in which case it is the pointer
722  // alignment.
723  switch (getEntryKind()) {
725  return TD.getPointerABIAlignment();
727  return TD.getABIIntegerTypeAlignment(64);
731  return TD.getABIIntegerTypeAlignment(32);
733  return 1;
734  }
735  llvm_unreachable("Unknown jump table encoding!");
736 }
737 
738 /// Create a new jump table entry in the jump table info.
740  const std::vector<MachineBasicBlock*> &DestBBs) {
741  assert(!DestBBs.empty() && "Cannot create an empty jump table!");
742  JumpTables.push_back(MachineJumpTableEntry(DestBBs));
743  return JumpTables.size()-1;
744 }
745 
746 /// If Old is the target of any jump tables, update the jump tables to branch
747 /// to New instead.
749  MachineBasicBlock *New) {
750  assert(Old != New && "Not making a change?");
751  bool MadeChange = false;
752  for (size_t i = 0, e = JumpTables.size(); i != e; ++i)
753  ReplaceMBBInJumpTable(i, Old, New);
754  return MadeChange;
755 }
756 
757 /// If Old is a target of the jump tables, update the jump table to branch to
758 /// New instead.
760  MachineBasicBlock *Old,
761  MachineBasicBlock *New) {
762  assert(Old != New && "Not making a change?");
763  bool MadeChange = false;
764  MachineJumpTableEntry &JTE = JumpTables[Idx];
765  for (size_t j = 0, e = JTE.MBBs.size(); j != e; ++j)
766  if (JTE.MBBs[j] == Old) {
767  JTE.MBBs[j] = New;
768  MadeChange = true;
769  }
770  return MadeChange;
771 }
772 
774  if (JumpTables.empty()) return;
775 
776  OS << "Jump Tables:\n";
777 
778  for (unsigned i = 0, e = JumpTables.size(); i != e; ++i) {
779  OS << " jt#" << i << ": ";
780  for (unsigned j = 0, f = JumpTables[i].MBBs.size(); j != f; ++j)
781  OS << " BB#" << JumpTables[i].MBBs[j]->getNumber();
782  }
783 
784  OS << '\n';
785 }
786 
787 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
789 #endif
790 
791 
792 //===----------------------------------------------------------------------===//
793 // MachineConstantPool implementation
794 //===----------------------------------------------------------------------===//
795 
796 void MachineConstantPoolValue::anchor() { }
797 
800  return Val.MachineCPVal->getType();
801  return Val.ConstVal->getType();
802 }
803 
804 
807  return Val.MachineCPVal->getRelocationInfo();
808  return Val.ConstVal->getRelocationInfo();
809 }
810 
814  switch (getRelocationInfo()) {
815  default:
816  llvm_unreachable("Unknown section kind");
819  break;
822  break;
824  switch (DL->getTypeAllocSize(getType())) {
825  case 4:
827  break;
828  case 8:
830  break;
831  case 16:
833  break;
834  default:
835  Kind = SectionKind::getReadOnly();
836  break;
837  }
838  }
839  return Kind;
840 }
841 
843  for (unsigned i = 0, e = Constants.size(); i != e; ++i)
844  if (Constants[i].isMachineConstantPoolEntry())
845  delete Constants[i].Val.MachineCPVal;
847  MachineCPVsSharingEntries.begin(), E = MachineCPVsSharingEntries.end();
848  I != E; ++I)
849  delete *I;
850 }
851 
852 /// Test whether the given two constants can be allocated the same constant pool
853 /// entry.
854 static bool CanShareConstantPoolEntry(const Constant *A, const Constant *B,
855  const DataLayout &DL) {
856  // Handle the trivial case quickly.
857  if (A == B) return true;
858 
859  // If they have the same type but weren't the same constant, quickly
860  // reject them.
861  if (A->getType() == B->getType()) return false;
862 
863  // We can't handle structs or arrays.
864  if (isa<StructType>(A->getType()) || isa<ArrayType>(A->getType()) ||
865  isa<StructType>(B->getType()) || isa<ArrayType>(B->getType()))
866  return false;
867 
868  // For now, only support constants with the same size.
869  uint64_t StoreSize = DL.getTypeStoreSize(A->getType());
870  if (StoreSize != DL.getTypeStoreSize(B->getType()) || StoreSize > 128)
871  return false;
872 
873  Type *IntTy = IntegerType::get(A->getContext(), StoreSize*8);
874 
875  // Try constant folding a bitcast of both instructions to an integer. If we
876  // get two identical ConstantInt's, then we are good to share them. We use
877  // the constant folding APIs to do this so that we get the benefit of
878  // DataLayout.
879  if (isa<PointerType>(A->getType()))
880  A = ConstantFoldInstOperands(Instruction::PtrToInt, IntTy,
881  const_cast<Constant *>(A), DL);
882  else if (A->getType() != IntTy)
883  A = ConstantFoldInstOperands(Instruction::BitCast, IntTy,
884  const_cast<Constant *>(A), DL);
885  if (isa<PointerType>(B->getType()))
886  B = ConstantFoldInstOperands(Instruction::PtrToInt, IntTy,
887  const_cast<Constant *>(B), DL);
888  else if (B->getType() != IntTy)
889  B = ConstantFoldInstOperands(Instruction::BitCast, IntTy,
890  const_cast<Constant *>(B), DL);
891 
892  return A == B;
893 }
894 
895 /// Create a new entry in the constant pool or return an existing one.
896 /// User must specify the log2 of the minimum required alignment for the object.
898  unsigned Alignment) {
899  assert(Alignment && "Alignment must be specified!");
900  if (Alignment > PoolAlignment) PoolAlignment = Alignment;
901 
902  // Check to see if we already have this constant.
903  //
904  // FIXME, this could be made much more efficient for large constant pools.
905  for (unsigned i = 0, e = Constants.size(); i != e; ++i)
906  if (!Constants[i].isMachineConstantPoolEntry() &&
907  CanShareConstantPoolEntry(Constants[i].Val.ConstVal, C, DL)) {
908  if ((unsigned)Constants[i].getAlignment() < Alignment)
909  Constants[i].Alignment = Alignment;
910  return i;
911  }
912 
913  Constants.push_back(MachineConstantPoolEntry(C, Alignment));
914  return Constants.size()-1;
915 }
916 
918  unsigned Alignment) {
919  assert(Alignment && "Alignment must be specified!");
920  if (Alignment > PoolAlignment) PoolAlignment = Alignment;
921 
922  // Check to see if we already have this constant.
923  //
924  // FIXME, this could be made much more efficient for large constant pools.
925  int Idx = V->getExistingMachineCPValue(this, Alignment);
926  if (Idx != -1) {
927  MachineCPVsSharingEntries.insert(V);
928  return (unsigned)Idx;
929  }
930 
931  Constants.push_back(MachineConstantPoolEntry(V, Alignment));
932  return Constants.size()-1;
933 }
934 
936  if (Constants.empty()) return;
937 
938  OS << "Constant Pool:\n";
939  for (unsigned i = 0, e = Constants.size(); i != e; ++i) {
940  OS << " cp#" << i << ": ";
941  if (Constants[i].isMachineConstantPoolEntry())
942  Constants[i].Val.MachineCPVal->print(OS);
943  else
944  Constants[i].Val.ConstVal->printAsOperand(OS, /*PrintType=*/false);
945  OS << ", align=" << Constants[i].getAlignment();
946  OS << "\n";
947  }
948 }
949 
950 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
952 #endif
unsigned getStackAlignment() const
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligne...
static SectionKind getReadOnlyWithRelLocal()
Definition: SectionKind.h:231
const MachineFunction * getParent() const
getParent - Return the MachineFunction containing this basic block.
A parsed version of the target data layout string in and methods for querying it. ...
Definition: DataLayout.h:104
BitVector & set()
Definition: BitVector.h:218
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
SectionKind getSectionKind(const DataLayout *DL) const
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
MachineInstr * CreateMachineInstr(const MCInstrDesc &MCID, DebugLoc DL, bool NoImp=false)
CreateMachineInstr - Allocate a new MachineInstr.
Alignment of stack for function (3 bits) stored as log2 of alignment with +1 bias 0 means unaligned (...
Definition: Attributes.h:106
BitVector getPristineRegs(const MachineFunction &MF) const
Return a set of physical registers that are pristine.
unsigned getPrefFunctionAlignment() const
Return the preferred function alignment.
void RenumberBlocks(MachineBasicBlock *MBBFrom=nullptr)
RenumberBlocks - This discards all of the MachineBasicBlock numbers and recomputes them...
livein_iterator livein_end() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:39
int getNumber() const
getNumber - MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a M...
unsigned createVirtualRegister(const TargetRegisterClass *RegClass)
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
void addLiveIn(unsigned Reg, unsigned vreg=0)
addLiveIn - Add the specified register as a live-in.
bool hasSubClassEq(const TargetRegisterClass *RC) const
hasSubClassEq - Returns true if RC is a sub-class of or equal to this class.
unsigned addLiveIn(unsigned PReg, const TargetRegisterClass *RC)
addLiveIn - Add the specified physical register as a live-in value and create a corresponding virtual...
Describe properties that are true of each instruction in the target description file.
Definition: MCInstrDesc.h:138
EK_Inline - Jump table entries are emitted inline at their point of use.
std::string getNodeLabel(const MachineBasicBlock *Node, const MachineFunction *Graph)
bool adjustsStack() const
Return true if this function adjusts the stack – e.g., when calling another function.
const char * getPrivateGlobalPrefix() const
Definition: DataLayout.h:281
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
static SectionKind getMergeableConst8()
Definition: SectionKind.h:219
static SectionKind getMergeableConst16()
Definition: SectionKind.h:220
A raw_ostream that writes to an SmallVector or SmallString.
Definition: raw_ostream.h:488
A debug info location.
Definition: DebugLoc.h:34
Metadata node.
Definition: Metadata.h:740
F(f)
const Function * getFunction() const
getFunction - Return the LLVM function that this machine code represents
Manage lifetime of a slot tracker for printing IR.
unsigned getFunctionNumber() const
getFunctionNumber - Return a unique ID for the current function.
void DeleteMachineBasicBlock(MachineBasicBlock *MBB)
DeleteMachineBasicBlock - Delete the given MachineBasicBlock.
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, unsigned f, uint64_t s, unsigned base_alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr)
getMachineMemOperand - Allocate a new MachineMemOperand.
static SectionKind getMergeableConst4()
Definition: SectionKind.h:218
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...
bool isStackRealignable() const
isStackRealignable - This method returns whether the stack can be realigned.
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:188
MachineJumpTableInfo * getOrCreateJumpTableInfo(unsigned JTEntryKind)
getOrCreateJumpTableInfo - Get the JumpTableInfo for this function, if it does already exist...
unsigned getMaxAlignment() const
Return the alignment in bytes that this function must be aligned to, which is greater than the defaul...
const std::vector< CalleeSavedInfo > & getCalleeSavedInfo() const
Returns a reference to call saved info vector for the current function.
unsigned getRelocationInfo() const
getRelocationInfo - This method classifies the entry according to whether or not it may generate a re...
void viewCFG() const
viewCFG - This function is meant for use from the debugger.
JTEntryKind
JTEntryKind - This enum indicates how each entry of the jump table is represented and emitted...
MachineMemOperand - A description of a memory reference used in the backend.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:79
unsigned getPointerABIAlignment(unsigned AS=0) const
Layout pointer alignment FIXME: The defaults need to be removed once all of the backends/clients are ...
Definition: DataLayout.cpp:575
static unsigned clampStackAlignment(bool ShouldClamp, unsigned Align, unsigned StackAlign)
Clamp the alignment if requested and emit a warning.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:98
const TargetRegisterClass * getRegClass(unsigned Reg) const
getRegClass - Return the register class of the specified virtual register.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
std::pair< MachineInstr::mmo_iterator, MachineInstr::mmo_iterator > extractLoadMemRefs(MachineInstr::mmo_iterator Begin, MachineInstr::mmo_iterator End)
extractLoadMemRefs - Allocate an array and populate it with just the load information from the given ...
Context object for machine code objects.
Definition: MCContext.h:48
PrintReg - Helper class for printing registers on a raw_ostream.
unsigned getNumRegs() const
Return the number of registers this target has (useful for sizing arrays holding per register informa...
void print(const MachineFunction &MF, raw_ostream &OS) const
Used by the MachineFunction printer to print information about stack objects.
int getObjectIndexBegin() const
Return the minimum frame object index.
SlotIndexes pass.
Definition: SlotIndexes.h:334
unsigned createJumpTableIndex(const std::vector< MachineBasicBlock * > &DestBBs)
createJumpTableIndex - Create a new jump table.
EK_LabelDifference32 - Each entry is the address of the block minus the address of the jump table...
virtual int getExistingMachineCPValue(MachineConstantPool *CP, unsigned Alignment)=0
static std::string getGraphName(const MachineFunction *F)
EK_BlockAddress - Each entry is a plain address of block, e.g.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition: SmallString.h:25
void print(raw_ostream &OS, SlotIndexes *=nullptr) const
print - Print out the MachineFunction in a format suitable for debugging to the specified stream...
This class is a data container for one entry in a MachineConstantPool.
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
virtual const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const =0
getCalleeSavedRegs - Return a null-terminated list of all of the callee saved registers on this targe...
MachineBasicBlock * CreateMachineBasicBlock(const BasicBlock *bb=nullptr)
CreateMachineBasicBlock - Allocate a new MachineBasicBlock.
unsigned getTransientStackAlignment() const
getTransientStackAlignment - This method returns the number of bytes to which the stack pointer must ...
const BasicBlock * getBasicBlock() const
getBasicBlock - Return the LLVM basic block that this instance corresponded to originally.
unsigned estimateStackSize(const MachineFunction &MF) const
Estimate and return the size of the stack frame.
bool isMachineConstantPoolEntry() const
isMachineConstantPoolEntry - Return true if the MachineConstantPoolEntry is indeed a target specific ...
static void deleteNode(NodeTy *V)
Definition: ilist.h:113
unsigned getEntrySize(const DataLayout &TD) const
getEntrySize - Return the size of each entry in the jump table.
unsigned getEntryAlignment(const DataLayout &TD) const
getEntryAlignment - Return the alignment of each entry in the jump table.
EK_GPRel64BlockAddress - Each entry is an address of block, encoded with a relocation as gp-relative...
unsigned getABIIntegerTypeAlignment(unsigned BitWidth) const
Returns the minimum ABI-required alignment for an integer type of the specified bitwidth.
Definition: DataLayout.cpp:680
unsigned int getFlags() const
getFlags - Return the raw flags of the source value,
EK_Custom32 - Each entry is a 32-bit value that is custom lowered by the TargetLowering::LowerCustomJ...
LLVM Basic Block Representation.
Definition: BasicBlock.h:65
virtual bool needsStackRealignment(const MachineFunction &MF) const
needsStackRealignment - true if storage within the function requires the stack pointer to be aligned ...
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:45
This is an important base class in LLVM.
Definition: Constant.h:41
LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ATTRIBUTE_RETURNS_NOALIAS void * Allocate(size_t Size, size_t Alignment)
Allocate space at the specified alignment.
Definition: Allocator.h:208
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.
unsigned getLiveInVirtReg(unsigned PReg) const
getLiveInVirtReg - If PReg is a live-in physical register, return the corresponding live-in physical ...
bool shouldSplitStack()
Should we be emitting segmented stack stuff for the function.
bool tracksLiveness() const
tracksLiveness - Returns true when tracking register liveness accurately.
void viewCFGOnly() const
viewCFGOnly - This function is meant for use from the debugger.
for(unsigned i=0, e=MI->getNumOperands();i!=e;++i)
SectionKind - This is a simple POD value that classifies the properties of a section.
Definition: SectionKind.h:28
const PseudoSourceValue * getPseudoValue() const
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:348
int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool Immutable, bool isAliased=false)
Create a new object at a fixed location on the stack.
bool isCalleeSavedInfoValid() const
Has the callee saved info been calculated yet?
std::vector< MachineBasicBlock * > MBBs
MBBs - The vector of basic blocks from which to create the jump table.
unsigned size() const
void incorporateFunction(const Function &F)
Incorporate the given function.
Definition: AsmWriter.cpp:681
void DeleteMachineInstr(MachineInstr *MI)
DeleteMachineInstr - Delete the given MachineInstr.
int CreateSpillStackObject(uint64_t Size, unsigned Alignment)
Create a new statically sized stack object that represents a spill slot, returning a nonnegative iden...
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
LLVMContext & getContext() const
All values hold a context through their type.
Definition: Value.cpp:519
Abstract base class for all machine specific constantpool value subclasses.
void Deallocate(const void *, size_t)
Definition: Allocator.h:255
MachinePointerInfo - This class contains a discriminated union of information about pointers in memor...
iterator erase(iterator where)
Definition: ilist.h:465
virtual bool hasReservedCallFrame(const MachineFunction &MF) const
hasReservedCallFrame - Under normal circumstances, when a frame pointer is not required, we reserve argument space for call sites in the function immediately on entry to the current function.
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
bool isDeadObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a dead object.
void print(raw_ostream &OS) const
print - Used by the MachineFunction printer to print information about constant pool objects...
DOTGraphTraits - Template class that can be specialized to customize how graphs are converted to 'dot...
virtual const TargetFrameLowering * getFrameLowering() const
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
Definition: Type.cpp:304
void print(raw_ostream &OS) const
print - Used by the MachineFunction printer to print information about jump tables.
MCSymbol * getPICBaseSymbol() const
getPICBaseSymbol - Return a function-local symbol to represent the PIC base.
uint64_t getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
Definition: DataLayout.h:388
void dump() const
dump - Call print(cerr) to be called from the debugger.
MachineInstr * CloneMachineInstr(const MachineInstr *Orig)
CloneMachineInstr - Create a new MachineInstr which is a copy of the 'Orig' instruction, identical in all ways except the instruction has no parent, prev, or next.
bool ReplaceMBBInJumpTables(MachineBasicBlock *Old, MachineBasicBlock *New)
ReplaceMBBInJumpTables - If Old is the target of any jump tables, update the jump tables to branch to...
Constant * ConstantFoldInstOperands(unsigned Opcode, Type *DestTy, ArrayRef< Constant * > Ops, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr)
ConstantFoldInstOperands - Attempt to constant fold an instruction with the specified operands...
unsigned getObjectAlignment(int ObjectIdx) const
Return the alignment of the specified stack object.
Module.h This file contains the declarations for the Module class.
Type * getType() const
All values are typed, get the type of this value.
Definition: Value.h:222
int getOffsetOfLocalArea() const
getOffsetOfLocalArea - This method returns the offset of the local area from the stack pointer on ent...
virtual const TargetLowering * getTargetLowering() const
const char * getLinkerPrivateGlobalPrefix() const
Definition: DataLayout.h:261
unsigned getMaxCallFrameSize() const
Return the maximum size of a call frame that must be allocated for an outgoing function call...
Information about stack frame layout on the target.
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
Definition: Metadata.h:548
static SectionKind getReadOnlyWithRel()
Definition: SectionKind.h:230
livein_iterator livein_begin() const
void clear(AllocatorType &Allocator)
Release all the tracked allocations to the allocator.
static cl::opt< AlignMode > Align(cl::desc("Load/store alignment support"), cl::Hidden, cl::init(NoStrictAlign), cl::values(clEnumValN(StrictAlign,"aarch64-strict-align","Disallow all unaligned memory accesses"), clEnumValN(NoStrictAlign,"aarch64-no-strict-align","Allow unaligned memory accesses"), clEnumValEnd))
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:123
MCSymbol * getJTISymbol(unsigned JTI, MCContext &Ctx, bool isLinkerPrivate=false) const
getJTISymbol - Return the MCSymbol for the specified non-empty jump table.
Target - Wrapper for Target specific information.
const Value * getValue() const
getValue - Return the base address of the memory access.
void dump() const
dump - Print the current MachineFunction to cerr, useful for debugger use.
MachineJumpTableEntry - One jump table in the jump table info.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
SI Fix SGPR Live Ranges
Representation of each machine instruction.
Definition: MachineInstr.h:51
uint64_t MinAlign(uint64_t A, uint64_t B)
MinAlign - A and B are either alignments or offsets.
Definition: MathExtras.h:552
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
Definition: Module.cpp:372
void ensureMaxAlignment(unsigned Align)
Make sure the function is at least Align bytes aligned.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
Definition: Function.h:217
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
Definition: MCContext.cpp:111
unsigned getMinFunctionAlignment() const
Return the minimum function alignment.
#define I(x, y, z)
Definition: MD5.cpp:54
int CreateFixedSpillStackObject(uint64_t Size, int64_t SPOffset)
Create a spill slot at a fixed location on the stack.
union llvm::MachineConstantPoolEntry::@30 Val
The constant itself.
uint64_t getTypeStoreSize(Type *Ty) const
Returns the maximum number of bytes that may be overwritten by storing the specified type...
Definition: DataLayout.h:371
bool hasVarSizedObjects() const
This method may be called any time after instruction selection is complete to determine if the stack ...
void dump() const
dump - Call to stderr.
int CreateStackObject(uint64_t Size, unsigned Alignment, bool isSS, const AllocaInst *Alloca=nullptr)
Create a new statically sized stack object, returning a nonnegative identifier to represent it...
JTEntryKind getEntryKind() const
std::vector< std::pair< unsigned, unsigned > >::const_iterator livein_iterator
std::pair< MachineInstr::mmo_iterator, MachineInstr::mmo_iterator > extractStoreMemRefs(MachineInstr::mmo_iterator Begin, MachineInstr::mmo_iterator End)
extractStoreMemRefs - Allocate an array and populate it with just the store information from the give...
const ARM::ArchExtKind Kind
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:465
aarch64 promote const
void dump(const MachineFunction &MF) const
dump - Print the function to stderr.
Module * getParent()
Get the module that this global value is contained inside of...
Definition: GlobalValue.h:365
int64_t getOffset() const
getOffset - For normal values, this is a byte offset added to the base address.
void deallocateOperandArray(OperandCapacity Cap, MachineOperand *Array)
Dellocate an array of MachineOperands and recycle the memory.
static const Function * getParent(const Value *V)
BasicBlockListType::iterator iterator
uint64_t getSize() const
getSize - Return the size in bytes of the memory reference.
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:38
#define DEBUG(X)
Definition: Debug.h:92
DefaultDOTGraphTraits - This class provides the default implementations of all of the DOTGraphTraits ...
Primary interface to the complete machine description for the target machine.
C - The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:40
EK_GPRel32BlockAddress - Each entry is an address of block, encoded with a relocation as gp-relative...
int getObjectIndexEnd() const
Return one past the maximum frame object index.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
void print(raw_ostream &OS, SlotIndexes *=nullptr) const
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:593
int CreateVariableSizedObject(unsigned Alignment, const AllocaInst *Alloca)
Notify the MachineFrameInfo object that a variable sized object has been created. ...
static SectionKind getReadOnly()
Definition: SectionKind.h:208
MachineInstr::mmo_iterator allocateMemRefsArray(unsigned long Num)
allocateMemRefsArray - Allocate an array to hold MachineMemOperand pointers.
unsigned getFnStackAlignment() const
Return the stack alignment for the function.
Definition: Function.h:233
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
unsigned getConstantPoolIndex(const Constant *C, unsigned Alignment)
getConstantPoolIndex - Create a new entry in the constant pool or return an existing one...
MachineModuleInfo - This class contains meta information specific to a module.
This file describes how to lower LLVM code to machine code.
AllocaInst - an instruction to allocate memory on the stack.
Definition: Instructions.h:76
uint64_t getBaseAlignment() const
getBaseAlignment - Return the minimum known alignment in bytes of the base address, without the offset.
bool contains(unsigned Reg) const
contains - Return true if the specified register is included in this register class.