LLVM  10.0.0svn
MachineFunction.h
Go to the documentation of this file.
1 //===- llvm/CodeGen/MachineFunction.h ---------------------------*- C++ -*-===//
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 for a function. This class contains a list of
10 // MachineBasicBlock instances that make up the current compiled function.
11 //
12 // This class also contains pointers to various classes which hold
13 // target-specific information about the generated code.
14 //
15 //===----------------------------------------------------------------------===//
16 
17 #ifndef LLVM_CODEGEN_MACHINEFUNCTION_H
18 #define LLVM_CODEGEN_MACHINEFUNCTION_H
19 
20 #include "llvm/ADT/ArrayRef.h"
21 #include "llvm/ADT/BitVector.h"
22 #include "llvm/ADT/DenseMap.h"
23 #include "llvm/ADT/GraphTraits.h"
24 #include "llvm/ADT/Optional.h"
25 #include "llvm/ADT/SmallVector.h"
26 #include "llvm/ADT/StringRef.h"
27 #include "llvm/ADT/ilist.h"
28 #include "llvm/ADT/iterator.h"
33 #include "llvm/Support/Allocator.h"
36 #include "llvm/Support/Compiler.h"
38 #include "llvm/Support/Recycler.h"
40 #include <cassert>
41 #include <cstdint>
42 #include <memory>
43 #include <utility>
44 #include <vector>
45 
46 namespace llvm {
47 
48 class BasicBlock;
49 class BlockAddress;
50 class DataLayout;
51 class DebugLoc;
52 class DIExpression;
53 class DILocalVariable;
54 class DILocation;
55 class Function;
56 class GlobalValue;
57 class LLVMTargetMachine;
58 class MachineConstantPool;
59 class MachineFrameInfo;
60 class MachineFunction;
61 class MachineJumpTableInfo;
62 class MachineModuleInfo;
63 class MachineRegisterInfo;
64 class MCContext;
65 class MCInstrDesc;
66 class MCSymbol;
67 class Pass;
68 class PseudoSourceValueManager;
69 class raw_ostream;
70 class SlotIndexes;
71 class TargetRegisterClass;
72 class TargetSubtargetInfo;
73 struct WasmEHFuncInfo;
74 struct WinEHFuncInfo;
75 
77  void deleteNode(MachineBasicBlock *MBB);
78 };
79 
81  void addNodeToList(MachineBasicBlock* N);
82  void removeNodeFromList(MachineBasicBlock* N);
83 
84  template <class Iterator>
85  void transferNodesFromList(ilist_callback_traits &OldList, Iterator, Iterator) {
86  assert(this == &OldList && "never transfer MBBs between functions");
87  }
88 };
89 
90 /// MachineFunctionInfo - This class can be derived from and used by targets to
91 /// hold private target-specific information for each MachineFunction. Objects
92 /// of type are accessed/created with MF::getInfo and destroyed when the
93 /// MachineFunction is destroyed.
95  virtual ~MachineFunctionInfo();
96 
97  /// Factory function: default behavior is to call new using the
98  /// supplied allocator.
99  ///
100  /// This function can be overridden in a derive class.
101  template<typename Ty>
103  return new (Allocator.Allocate<Ty>()) Ty(MF);
104  }
105 };
106 
107 /// Properties which a MachineFunction may have at a given point in time.
108 /// Each of these has checking code in the MachineVerifier, and passes can
109 /// require that a property be set.
111  // Possible TODO: Allow targets to extend this (perhaps by allowing the
112  // constructor to specify the size of the bit vector)
113  // Possible TODO: Allow requiring the negative (e.g. VRegsAllocated could be
114  // stated as the negative of "has vregs"
115 
116 public:
117  // The properties are stated in "positive" form; i.e. a pass could require
118  // that the property hold, but not that it does not hold.
119 
120  // Property descriptions:
121  // IsSSA: True when the machine function is in SSA form and virtual registers
122  // have a single def.
123  // NoPHIs: The machine function does not contain any PHI instruction.
124  // TracksLiveness: True when tracking register liveness accurately.
125  // While this property is set, register liveness information in basic block
126  // live-in lists and machine instruction operands (e.g. kill flags, implicit
127  // defs) is accurate. This means it can be used to change the code in ways
128  // that affect the values in registers, for example by the register
129  // scavenger.
130  // When this property is clear, liveness is no longer reliable.
131  // NoVRegs: The machine function does not use any virtual registers.
132  // Legalized: In GlobalISel: the MachineLegalizer ran and all pre-isel generic
133  // instructions have been legalized; i.e., all instructions are now one of:
134  // - generic and always legal (e.g., COPY)
135  // - target-specific
136  // - legal pre-isel generic instructions.
137  // RegBankSelected: In GlobalISel: the RegBankSelect pass ran and all generic
138  // virtual registers have been assigned to a register bank.
139  // Selected: In GlobalISel: the InstructionSelect pass ran and all pre-isel
140  // generic instructions have been eliminated; i.e., all instructions are now
141  // target-specific or non-pre-isel generic instructions (e.g., COPY).
142  // Since only pre-isel generic instructions can have generic virtual register
143  // operands, this also means that all generic virtual registers have been
144  // constrained to virtual registers (assigned to register classes) and that
145  // all sizes attached to them have been eliminated.
146  enum class Property : unsigned {
147  IsSSA,
148  NoPHIs,
149  TracksLiveness,
150  NoVRegs,
151  FailedISel,
152  Legalized,
153  RegBankSelected,
154  Selected,
155  LastProperty = Selected,
156  };
157 
158  bool hasProperty(Property P) const {
159  return Properties[static_cast<unsigned>(P)];
160  }
161 
163  Properties.set(static_cast<unsigned>(P));
164  return *this;
165  }
166 
168  Properties.reset(static_cast<unsigned>(P));
169  return *this;
170  }
171 
172  /// Reset all the properties.
174  Properties.reset();
175  return *this;
176  }
177 
179  Properties |= MFP.Properties;
180  return *this;
181  }
182 
184  Properties.reset(MFP.Properties);
185  return *this;
186  }
187 
188  // Returns true if all properties set in V (i.e. required by a pass) are set
189  // in this.
191  return !V.Properties.test(Properties);
192  }
193 
194  /// Print the MachineFunctionProperties in human-readable form.
195  void print(raw_ostream &OS) const;
196 
197 private:
198  BitVector Properties =
199  BitVector(static_cast<unsigned>(Property::LastProperty)+1);
200 };
201 
202 struct SEHHandler {
203  /// Filter or finally function. Null indicates a catch-all.
205 
206  /// Address of block to recover at. Null for a finally handler.
208 };
209 
210 /// This structure is used to retain landing pad info for the current function.
212  MachineBasicBlock *LandingPadBlock; // Landing pad block.
213  SmallVector<MCSymbol *, 1> BeginLabels; // Labels prior to invoke.
214  SmallVector<MCSymbol *, 1> EndLabels; // Labels after invoke.
215  SmallVector<SEHHandler, 1> SEHHandlers; // SEH handlers active at this lpad.
216  MCSymbol *LandingPadLabel = nullptr; // Label at beginning of landing pad.
217  std::vector<int> TypeIds; // List of type ids (filters negative).
218 
220  : LandingPadBlock(MBB) {}
221 };
222 
224  const Function &F;
225  const LLVMTargetMachine &Target;
226  const TargetSubtargetInfo *STI;
227  MCContext &Ctx;
228  MachineModuleInfo &MMI;
229 
230  // RegInfo - Information about each register in use in the function.
232 
233  // Used to keep track of target-specific per-machine function information for
234  // the target implementation.
235  MachineFunctionInfo *MFInfo;
236 
237  // Keep track of objects allocated on the stack.
238  MachineFrameInfo *FrameInfo;
239 
240  // Keep track of constants which are spilled to memory
242 
243  // Keep track of jump tables for switch instructions
244  MachineJumpTableInfo *JumpTableInfo;
245 
246  // Keeps track of Wasm exception handling related data. This will be null for
247  // functions that aren't using a wasm EH personality.
248  WasmEHFuncInfo *WasmEHInfo = nullptr;
249 
250  // Keeps track of Windows exception handling related data. This will be null
251  // for functions that aren't using a funclet-based EH personality.
252  WinEHFuncInfo *WinEHInfo = nullptr;
253 
254  // Function-level unique numbering for MachineBasicBlocks. When a
255  // MachineBasicBlock is inserted into a MachineFunction is it automatically
256  // numbered and this vector keeps track of the mapping from ID's to MBB's.
257  std::vector<MachineBasicBlock*> MBBNumbering;
258 
259  // Pool-allocate MachineFunction-lifetime and IR objects.
261 
262  // Allocation management for instructions in function.
263  Recycler<MachineInstr> InstructionRecycler;
264 
265  // Allocation management for operand arrays on instructions.
266  ArrayRecycler<MachineOperand> OperandRecycler;
267 
268  // Allocation management for basic blocks in function.
269  Recycler<MachineBasicBlock> BasicBlockRecycler;
270 
271  // List of machine basic blocks in function
273  BasicBlockListType BasicBlocks;
274 
275  /// FunctionNumber - This provides a unique ID for each function emitted in
276  /// this translation unit.
277  ///
278  unsigned FunctionNumber;
279 
280  /// Alignment - The alignment of the function.
281  Align Alignment;
282 
283  /// ExposesReturnsTwice - True if the function calls setjmp or related
284  /// functions with attribute "returns twice", but doesn't have
285  /// the attribute itself.
286  /// This is used to limit optimizations which cannot reason
287  /// about the control flow of such functions.
288  bool ExposesReturnsTwice = false;
289 
290  /// True if the function includes any inline assembly.
291  bool HasInlineAsm = false;
292 
293  /// True if any WinCFI instruction have been emitted in this function.
294  bool HasWinCFI = false;
295 
296  /// Current high-level properties of the IR of the function (e.g. is in SSA
297  /// form or whether registers have been allocated)
298  MachineFunctionProperties Properties;
299 
300  // Allocation management for pseudo source values.
301  std::unique_ptr<PseudoSourceValueManager> PSVManager;
302 
303  /// List of moves done by a function's prolog. Used to construct frame maps
304  /// by debug and exception handling consumers.
305  std::vector<MCCFIInstruction> FrameInstructions;
306 
307  /// \name Exception Handling
308  /// \{
309 
310  /// List of LandingPadInfo describing the landing pad information.
311  std::vector<LandingPadInfo> LandingPads;
312 
313  /// Map a landing pad's EH symbol to the call site indexes.
315 
316  /// Map a landing pad to its index.
318 
319  /// Map of invoke call site index values to associated begin EH_LABEL.
320  DenseMap<MCSymbol*, unsigned> CallSiteMap;
321 
322  /// CodeView label annotations.
323  std::vector<std::pair<MCSymbol *, MDNode *>> CodeViewAnnotations;
324 
325  /// CodeView heapallocsites.
326  std::vector<std::tuple<MCSymbol *, MCSymbol *, const DIType *>>
327  CodeViewHeapAllocSites;
328 
329  bool CallsEHReturn = false;
330  bool CallsUnwindInit = false;
331  bool HasEHScopes = false;
332  bool HasEHFunclets = false;
333 
334  /// List of C++ TypeInfo used.
335  std::vector<const GlobalValue *> TypeInfos;
336 
337  /// List of typeids encoding filters used.
338  std::vector<unsigned> FilterIds;
339 
340  /// List of the indices in FilterIds corresponding to filter terminators.
341  std::vector<unsigned> FilterEnds;
342 
343  EHPersonality PersonalityTypeCache = EHPersonality::Unknown;
344 
345  /// \}
346 
347  /// Clear all the members of this MachineFunction, but the ones used
348  /// to initialize again the MachineFunction.
349  /// More specifically, this deallocates all the dynamically allocated
350  /// objects and get rid of all the XXXInfo data structure, but keep
351  /// unchanged the references to Fn, Target, MMI, and FunctionNumber.
352  void clear();
353  /// Allocate and initialize the different members.
354  /// In particular, the XXXInfo data structure.
355  /// \pre Fn, Target, MMI, and FunctionNumber are properly set.
356  void init();
357 
358 public:
362  // The Slot can be negative for fixed stack objects.
363  int Slot;
364  const DILocation *Loc;
365 
367  int Slot, const DILocation *Loc)
368  : Var(Var), Expr(Expr), Slot(Slot), Loc(Loc) {}
369  };
370 
371  class Delegate {
372  virtual void anchor();
373 
374  public:
375  virtual ~Delegate() = default;
376  /// Callback after an insertion. This should not modify the MI directly.
377  virtual void MF_HandleInsertion(MachineInstr &MI) = 0;
378  /// Callback before a removal. This should not modify the MI directly.
379  virtual void MF_HandleRemoval(MachineInstr &MI) = 0;
380  };
381 
382  /// Structure used to represent pair of argument number after call lowering
383  /// and register used to transfer that argument.
384  /// For now we support only cases when argument is transferred through one
385  /// register.
386  struct ArgRegPair {
387  unsigned Reg;
388  uint16_t ArgNo;
389  ArgRegPair(unsigned R, unsigned Arg) : Reg(R), ArgNo(Arg) {
390  assert(Arg < (1 << 16) && "Arg out of range");
391  }
392  };
393  /// Vector of call argument and its forwarding register.
396 
397 private:
398  Delegate *TheDelegate = nullptr;
399 
401  /// Map a call instruction to call site arguments forwarding info.
402  CallSiteInfoMap CallSitesInfo;
403 
404  /// A helper function that returns call site info for a give call
405  /// instruction if debug entry value support is enabled.
406  CallSiteInfoMap::iterator getCallSiteInfo(const MachineInstr *MI) {
407  assert(MI->isCall() &&
408  "Call site info refers only to call instructions!");
409 
410  if (!Target.Options.EnableDebugEntryValues)
411  return CallSitesInfo.end();
412  return CallSitesInfo.find(MI);
413  }
414 
415  // Callbacks for insertion and removal.
416  void handleInsertion(MachineInstr &MI);
417  void handleRemoval(MachineInstr &MI);
418  friend struct ilist_traits<MachineInstr>;
419 
420 public:
423 
424  MachineFunction(const Function &F, const LLVMTargetMachine &Target,
425  const TargetSubtargetInfo &STI, unsigned FunctionNum,
426  MachineModuleInfo &MMI);
427  MachineFunction(const MachineFunction &) = delete;
428  MachineFunction &operator=(const MachineFunction &) = delete;
429  ~MachineFunction();
430 
431  /// Reset the instance as if it was just created.
432  void reset() {
433  clear();
434  init();
435  }
436 
437  /// Reset the currently registered delegate - otherwise assert.
438  void resetDelegate(Delegate *delegate) {
439  assert(TheDelegate == delegate &&
440  "Only the current delegate can perform reset!");
441  TheDelegate = nullptr;
442  }
443 
444  /// Set the delegate. resetDelegate must be called before attempting
445  /// to set.
446  void setDelegate(Delegate *delegate) {
447  assert(delegate && !TheDelegate &&
448  "Attempted to set delegate to null, or to change it without "
449  "first resetting it!");
450 
451  TheDelegate = delegate;
452  }
453 
454  MachineModuleInfo &getMMI() const { return MMI; }
455  MCContext &getContext() const { return Ctx; }
456 
457  PseudoSourceValueManager &getPSVManager() const { return *PSVManager; }
458 
459  /// Return the DataLayout attached to the Module associated to this MF.
460  const DataLayout &getDataLayout() const;
461 
462  /// Return the LLVM function that this machine code represents
463  const Function &getFunction() const { return F; }
464 
465  /// getName - Return the name of the corresponding LLVM function.
466  StringRef getName() const;
467 
468  /// getFunctionNumber - Return a unique ID for the current function.
469  unsigned getFunctionNumber() const { return FunctionNumber; }
470 
471  /// getTarget - Return the target machine this machine code is compiled with
472  const LLVMTargetMachine &getTarget() const { return Target; }
473 
474  /// getSubtarget - Return the subtarget for which this machine code is being
475  /// compiled.
476  const TargetSubtargetInfo &getSubtarget() const { return *STI; }
477 
478  /// getSubtarget - This method returns a pointer to the specified type of
479  /// TargetSubtargetInfo. In debug builds, it verifies that the object being
480  /// returned is of the correct type.
481  template<typename STC> const STC &getSubtarget() const {
482  return *static_cast<const STC *>(STI);
483  }
484 
485  /// getRegInfo - Return information about the registers currently in use.
486  MachineRegisterInfo &getRegInfo() { return *RegInfo; }
487  const MachineRegisterInfo &getRegInfo() const { return *RegInfo; }
488 
489  /// getFrameInfo - Return the frame info object for the current function.
490  /// This object contains information about objects allocated on the stack
491  /// frame of the current function in an abstract way.
492  MachineFrameInfo &getFrameInfo() { return *FrameInfo; }
493  const MachineFrameInfo &getFrameInfo() const { return *FrameInfo; }
494 
495  /// getJumpTableInfo - Return the jump table info object for the current
496  /// function. This object contains information about jump tables in the
497  /// current function. If the current function has no jump tables, this will
498  /// return null.
499  const MachineJumpTableInfo *getJumpTableInfo() const { return JumpTableInfo; }
500  MachineJumpTableInfo *getJumpTableInfo() { return JumpTableInfo; }
501 
502  /// getOrCreateJumpTableInfo - Get the JumpTableInfo for this function, if it
503  /// does already exist, allocate one.
504  MachineJumpTableInfo *getOrCreateJumpTableInfo(unsigned JTEntryKind);
505 
506  /// getConstantPool - Return the constant pool object for the current
507  /// function.
510 
511  /// getWasmEHFuncInfo - Return information about how the current function uses
512  /// Wasm exception handling. Returns null for functions that don't use wasm
513  /// exception handling.
514  const WasmEHFuncInfo *getWasmEHFuncInfo() const { return WasmEHInfo; }
515  WasmEHFuncInfo *getWasmEHFuncInfo() { return WasmEHInfo; }
516 
517  /// getWinEHFuncInfo - Return information about how the current function uses
518  /// Windows exception handling. Returns null for functions that don't use
519  /// funclets for exception handling.
520  const WinEHFuncInfo *getWinEHFuncInfo() const { return WinEHInfo; }
521  WinEHFuncInfo *getWinEHFuncInfo() { return WinEHInfo; }
522 
523  /// getAlignment - Return the alignment of the function.
524  Align getAlignment() const { return Alignment; }
525 
526  /// setAlignment - Set the alignment of the function.
527  void setAlignment(Align A) { Alignment = A; }
528 
529  /// ensureAlignment - Make sure the function is at least A bytes aligned.
531  if (Alignment < A)
532  Alignment = A;
533  }
534 
535  /// exposesReturnsTwice - Returns true if the function calls setjmp or
536  /// any other similar functions with attribute "returns twice" without
537  /// having the attribute itself.
538  bool exposesReturnsTwice() const {
539  return ExposesReturnsTwice;
540  }
541 
542  /// setCallsSetJmp - Set a flag that indicates if there's a call to
543  /// a "returns twice" function.
545  ExposesReturnsTwice = B;
546  }
547 
548  /// Returns true if the function contains any inline assembly.
549  bool hasInlineAsm() const {
550  return HasInlineAsm;
551  }
552 
553  /// Set a flag that indicates that the function contains inline assembly.
554  void setHasInlineAsm(bool B) {
555  HasInlineAsm = B;
556  }
557 
558  bool hasWinCFI() const {
559  return HasWinCFI;
560  }
561  void setHasWinCFI(bool v) { HasWinCFI = v; }
562 
563  /// Get the function properties
564  const MachineFunctionProperties &getProperties() const { return Properties; }
565  MachineFunctionProperties &getProperties() { return Properties; }
566 
567  /// getInfo - Keep track of various per-function pieces of information for
568  /// backends that would like to do so.
569  ///
570  template<typename Ty>
571  Ty *getInfo() {
572  if (!MFInfo)
573  MFInfo = Ty::template create<Ty>(Allocator, *this);
574  return static_cast<Ty*>(MFInfo);
575  }
576 
577  template<typename Ty>
578  const Ty *getInfo() const {
579  return const_cast<MachineFunction*>(this)->getInfo<Ty>();
580  }
581 
582  /// getBlockNumbered - MachineBasicBlocks are automatically numbered when they
583  /// are inserted into the machine function. The block number for a machine
584  /// basic block can be found by using the MBB::getNumber method, this method
585  /// provides the inverse mapping.
587  assert(N < MBBNumbering.size() && "Illegal block number");
588  assert(MBBNumbering[N] && "Block was removed from the machine function!");
589  return MBBNumbering[N];
590  }
591 
592  /// Should we be emitting segmented stack stuff for the function
593  bool shouldSplitStack() const;
594 
595  /// getNumBlockIDs - Return the number of MBB ID's allocated.
596  unsigned getNumBlockIDs() const { return (unsigned)MBBNumbering.size(); }
597 
598  /// RenumberBlocks - This discards all of the MachineBasicBlock numbers and
599  /// recomputes them. This guarantees that the MBB numbers are sequential,
600  /// dense, and match the ordering of the blocks within the function. If a
601  /// specific MachineBasicBlock is specified, only that block and those after
602  /// it are renumbered.
603  void RenumberBlocks(MachineBasicBlock *MBBFrom = nullptr);
604 
605  /// print - Print out the MachineFunction in a format suitable for debugging
606  /// to the specified stream.
607  void print(raw_ostream &OS, const SlotIndexes* = nullptr) const;
608 
609  /// viewCFG - This function is meant for use from the debugger. You can just
610  /// say 'call F->viewCFG()' and a ghostview window should pop up from the
611  /// program, displaying the CFG of the current function with the code for each
612  /// basic block inside. This depends on there being a 'dot' and 'gv' program
613  /// in your path.
614  void viewCFG() const;
615 
616  /// viewCFGOnly - This function is meant for use from the debugger. It works
617  /// just like viewCFG, but it does not include the contents of basic blocks
618  /// into the nodes, just the label. If you are only interested in the CFG
619  /// this can make the graph smaller.
620  ///
621  void viewCFGOnly() const;
622 
623  /// dump - Print the current MachineFunction to cerr, useful for debugger use.
624  void dump() const;
625 
626  /// Run the current MachineFunction through the machine code verifier, useful
627  /// for debugger use.
628  /// \returns true if no problems were found.
629  bool verify(Pass *p = nullptr, const char *Banner = nullptr,
630  bool AbortOnError = true) const;
631 
632  // Provide accessors for the MachineBasicBlock list...
637 
638  /// Support for MachineBasicBlock::getNextNode().
641  return &MachineFunction::BasicBlocks;
642  }
643 
644  /// addLiveIn - Add the specified physical register as a live-in value and
645  /// create a corresponding virtual register for it.
646  unsigned addLiveIn(unsigned PReg, const TargetRegisterClass *RC);
647 
648  //===--------------------------------------------------------------------===//
649  // BasicBlock accessor functions.
650  //
651  iterator begin() { return BasicBlocks.begin(); }
652  const_iterator begin() const { return BasicBlocks.begin(); }
653  iterator end () { return BasicBlocks.end(); }
654  const_iterator end () const { return BasicBlocks.end(); }
655 
656  reverse_iterator rbegin() { return BasicBlocks.rbegin(); }
657  const_reverse_iterator rbegin() const { return BasicBlocks.rbegin(); }
658  reverse_iterator rend () { return BasicBlocks.rend(); }
659  const_reverse_iterator rend () const { return BasicBlocks.rend(); }
660 
661  unsigned size() const { return (unsigned)BasicBlocks.size();}
662  bool empty() const { return BasicBlocks.empty(); }
663  const MachineBasicBlock &front() const { return BasicBlocks.front(); }
664  MachineBasicBlock &front() { return BasicBlocks.front(); }
665  const MachineBasicBlock & back() const { return BasicBlocks.back(); }
666  MachineBasicBlock & back() { return BasicBlocks.back(); }
667 
668  void push_back (MachineBasicBlock *MBB) { BasicBlocks.push_back (MBB); }
669  void push_front(MachineBasicBlock *MBB) { BasicBlocks.push_front(MBB); }
670  void insert(iterator MBBI, MachineBasicBlock *MBB) {
671  BasicBlocks.insert(MBBI, MBB);
672  }
673  void splice(iterator InsertPt, iterator MBBI) {
674  BasicBlocks.splice(InsertPt, BasicBlocks, MBBI);
675  }
676  void splice(iterator InsertPt, MachineBasicBlock *MBB) {
677  BasicBlocks.splice(InsertPt, BasicBlocks, MBB);
678  }
679  void splice(iterator InsertPt, iterator MBBI, iterator MBBE) {
680  BasicBlocks.splice(InsertPt, BasicBlocks, MBBI, MBBE);
681  }
682 
683  void remove(iterator MBBI) { BasicBlocks.remove(MBBI); }
684  void remove(MachineBasicBlock *MBBI) { BasicBlocks.remove(MBBI); }
685  void erase(iterator MBBI) { BasicBlocks.erase(MBBI); }
686  void erase(MachineBasicBlock *MBBI) { BasicBlocks.erase(MBBI); }
687 
688  template <typename Comp>
689  void sort(Comp comp) {
690  BasicBlocks.sort(comp);
691  }
692 
693  /// Return the number of \p MachineInstrs in this \p MachineFunction.
694  unsigned getInstructionCount() const {
695  unsigned InstrCount = 0;
696  for (const MachineBasicBlock &MBB : BasicBlocks)
697  InstrCount += MBB.size();
698  return InstrCount;
699  }
700 
701  //===--------------------------------------------------------------------===//
702  // Internal functions used to automatically number MachineBasicBlocks
703 
704  /// Adds the MBB to the internal numbering. Returns the unique number
705  /// assigned to the MBB.
707  MBBNumbering.push_back(MBB);
708  return (unsigned)MBBNumbering.size()-1;
709  }
710 
711  /// removeFromMBBNumbering - Remove the specific machine basic block from our
712  /// tracker, this is only really to be used by the MachineBasicBlock
713  /// implementation.
714  void removeFromMBBNumbering(unsigned N) {
715  assert(N < MBBNumbering.size() && "Illegal basic block #");
716  MBBNumbering[N] = nullptr;
717  }
718 
719  /// CreateMachineInstr - Allocate a new MachineInstr. Use this instead
720  /// of `new MachineInstr'.
721  MachineInstr *CreateMachineInstr(const MCInstrDesc &MCID, const DebugLoc &DL,
722  bool NoImp = false);
723 
724  /// Create a new MachineInstr which is a copy of \p Orig, identical in all
725  /// ways except the instruction has no parent, prev, or next. Bundling flags
726  /// are reset.
727  ///
728  /// Note: Clones a single instruction, not whole instruction bundles.
729  /// Does not perform target specific adjustments; consider using
730  /// TargetInstrInfo::duplicate() instead.
731  MachineInstr *CloneMachineInstr(const MachineInstr *Orig);
732 
733  /// Clones instruction or the whole instruction bundle \p Orig and insert
734  /// into \p MBB before \p InsertBefore.
735  ///
736  /// Note: Does not perform target specific adjustments; consider using
737  /// TargetInstrInfo::duplicate() intead.
738  MachineInstr &CloneMachineInstrBundle(MachineBasicBlock &MBB,
739  MachineBasicBlock::iterator InsertBefore, const MachineInstr &Orig);
740 
741  /// DeleteMachineInstr - Delete the given MachineInstr.
742  void DeleteMachineInstr(MachineInstr *MI);
743 
744  /// CreateMachineBasicBlock - Allocate a new MachineBasicBlock. Use this
745  /// instead of `new MachineBasicBlock'.
746  MachineBasicBlock *CreateMachineBasicBlock(const BasicBlock *bb = nullptr);
747 
748  /// DeleteMachineBasicBlock - Delete the given MachineBasicBlock.
749  void DeleteMachineBasicBlock(MachineBasicBlock *MBB);
750 
751  /// getMachineMemOperand - Allocate a new MachineMemOperand.
752  /// MachineMemOperands are owned by the MachineFunction and need not be
753  /// explicitly deallocated.
755  MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, uint64_t s,
756  unsigned base_alignment, const AAMDNodes &AAInfo = AAMDNodes(),
757  const MDNode *Ranges = nullptr,
760  AtomicOrdering FailureOrdering = AtomicOrdering::NotAtomic);
761 
762  /// getMachineMemOperand - Allocate a new MachineMemOperand by copying
763  /// an existing one, adjusting by an offset and using the given size.
764  /// MachineMemOperands are owned by the MachineFunction and need not be
765  /// explicitly deallocated.
767  int64_t Offset, uint64_t Size);
768 
769  /// Allocate a new MachineMemOperand by copying an existing one,
770  /// replacing only AliasAnalysis information. MachineMemOperands are owned
771  /// by the MachineFunction and need not be explicitly deallocated.
773  const AAMDNodes &AAInfo);
774 
775  /// Allocate a new MachineMemOperand by copying an existing one,
776  /// replacing the flags. MachineMemOperands are owned
777  /// by the MachineFunction and need not be explicitly deallocated.
780 
782 
783  /// Allocate an array of MachineOperands. This is only intended for use by
784  /// internal MachineInstr functions.
786  return OperandRecycler.allocate(Cap, Allocator);
787  }
788 
789  /// Dellocate an array of MachineOperands and recycle the memory. This is
790  /// only intended for use by internal MachineInstr functions.
791  /// Cap must be the same capacity that was used to allocate the array.
793  OperandRecycler.deallocate(Cap, Array);
794  }
795 
796  /// Allocate and initialize a register mask with @p NumRegister bits.
797  uint32_t *allocateRegMask();
798 
799  /// Allocate and construct an extra info structure for a `MachineInstr`.
800  ///
801  /// This is allocated on the function's allocator and so lives the life of
802  /// the function.
803  MachineInstr::ExtraInfo *
804  createMIExtraInfo(ArrayRef<MachineMemOperand *> MMOs,
805  MCSymbol *PreInstrSymbol = nullptr,
806  MCSymbol *PostInstrSymbol = nullptr);
807 
808  /// Allocate a string and populate it with the given external symbol name.
809  const char *createExternalSymbolName(StringRef Name);
810 
811  //===--------------------------------------------------------------------===//
812  // Label Manipulation.
813 
814  /// getJTISymbol - Return the MCSymbol for the specified non-empty jump table.
815  /// If isLinkerPrivate is specified, an 'l' label is returned, otherwise a
816  /// normal 'L' label is returned.
817  MCSymbol *getJTISymbol(unsigned JTI, MCContext &Ctx,
818  bool isLinkerPrivate = false) const;
819 
820  /// getPICBaseSymbol - Return a function-local symbol to represent the PIC
821  /// base.
822  MCSymbol *getPICBaseSymbol() const;
823 
824  /// Returns a reference to a list of cfi instructions in the function's
825  /// prologue. Used to construct frame maps for debug and exception handling
826  /// comsumers.
827  const std::vector<MCCFIInstruction> &getFrameInstructions() const {
828  return FrameInstructions;
829  }
830 
831  LLVM_NODISCARD unsigned addFrameInst(const MCCFIInstruction &Inst);
832 
833  /// \name Exception Handling
834  /// \{
835 
836  bool callsEHReturn() const { return CallsEHReturn; }
837  void setCallsEHReturn(bool b) { CallsEHReturn = b; }
838 
839  bool callsUnwindInit() const { return CallsUnwindInit; }
840  void setCallsUnwindInit(bool b) { CallsUnwindInit = b; }
841 
842  bool hasEHScopes() const { return HasEHScopes; }
843  void setHasEHScopes(bool V) { HasEHScopes = V; }
844 
845  bool hasEHFunclets() const { return HasEHFunclets; }
846  void setHasEHFunclets(bool V) { HasEHFunclets = V; }
847 
848  /// Find or create an LandingPadInfo for the specified MachineBasicBlock.
849  LandingPadInfo &getOrCreateLandingPadInfo(MachineBasicBlock *LandingPad);
850 
851  /// Remap landing pad labels and remove any deleted landing pads.
852  void tidyLandingPads(DenseMap<MCSymbol *, uintptr_t> *LPMap = nullptr,
853  bool TidyIfNoBeginLabels = true);
854 
855  /// Return a reference to the landing pad info for the current function.
856  const std::vector<LandingPadInfo> &getLandingPads() const {
857  return LandingPads;
858  }
859 
860  /// Provide the begin and end labels of an invoke style call and associate it
861  /// with a try landing pad block.
862  void addInvoke(MachineBasicBlock *LandingPad,
863  MCSymbol *BeginLabel, MCSymbol *EndLabel);
864 
865  /// Add a new panding pad, and extract the exception handling information from
866  /// the landingpad instruction. Returns the label ID for the landing pad
867  /// entry.
868  MCSymbol *addLandingPad(MachineBasicBlock *LandingPad);
869 
870  /// Provide the catch typeinfo for a landing pad.
871  void addCatchTypeInfo(MachineBasicBlock *LandingPad,
873 
874  /// Provide the filter typeinfo for a landing pad.
875  void addFilterTypeInfo(MachineBasicBlock *LandingPad,
877 
878  /// Add a cleanup action for a landing pad.
879  void addCleanup(MachineBasicBlock *LandingPad);
880 
881  void addSEHCatchHandler(MachineBasicBlock *LandingPad, const Function *Filter,
882  const BlockAddress *RecoverBA);
883 
884  void addSEHCleanupHandler(MachineBasicBlock *LandingPad,
885  const Function *Cleanup);
886 
887  /// Return the type id for the specified typeinfo. This is function wide.
888  unsigned getTypeIDFor(const GlobalValue *TI);
889 
890  /// Return the id of the filter encoded by TyIds. This is function wide.
891  int getFilterIDFor(std::vector<unsigned> &TyIds);
892 
893  /// Map the landing pad's EH symbol to the call site indexes.
894  void setCallSiteLandingPad(MCSymbol *Sym, ArrayRef<unsigned> Sites);
895 
896  /// Map the landing pad to its index. Used for Wasm exception handling.
897  void setWasmLandingPadIndex(const MachineBasicBlock *LPad, unsigned Index) {
898  WasmLPadToIndexMap[LPad] = Index;
899  }
900 
901  /// Returns true if the landing pad has an associate index in wasm EH.
902  bool hasWasmLandingPadIndex(const MachineBasicBlock *LPad) const {
903  return WasmLPadToIndexMap.count(LPad);
904  }
905 
906  /// Get the index in wasm EH for a given landing pad.
907  unsigned getWasmLandingPadIndex(const MachineBasicBlock *LPad) const {
908  assert(hasWasmLandingPadIndex(LPad));
909  return WasmLPadToIndexMap.lookup(LPad);
910  }
911 
912  /// Get the call site indexes for a landing pad EH symbol.
914  assert(hasCallSiteLandingPad(Sym) &&
915  "missing call site number for landing pad!");
916  return LPadToCallSiteMap[Sym];
917  }
918 
919  /// Return true if the landing pad Eh symbol has an associated call site.
921  return !LPadToCallSiteMap[Sym].empty();
922  }
923 
924  /// Map the begin label for a call site.
925  void setCallSiteBeginLabel(MCSymbol *BeginLabel, unsigned Site) {
926  CallSiteMap[BeginLabel] = Site;
927  }
928 
929  /// Get the call site number for a begin label.
930  unsigned getCallSiteBeginLabel(MCSymbol *BeginLabel) const {
931  assert(hasCallSiteBeginLabel(BeginLabel) &&
932  "Missing call site number for EH_LABEL!");
933  return CallSiteMap.lookup(BeginLabel);
934  }
935 
936  /// Return true if the begin label has a call site number associated with it.
937  bool hasCallSiteBeginLabel(MCSymbol *BeginLabel) const {
938  return CallSiteMap.count(BeginLabel);
939  }
940 
941  /// Record annotations associated with a particular label.
943  CodeViewAnnotations.push_back({Label, MD});
944  }
945 
947  return CodeViewAnnotations;
948  }
949 
950  /// Record heapallocsites
951  void addCodeViewHeapAllocSite(MachineInstr *I, const MDNode *MD);
952 
955  return CodeViewHeapAllocSites;
956  }
957 
958  /// Return a reference to the C++ typeinfo for the current function.
959  const std::vector<const GlobalValue *> &getTypeInfos() const {
960  return TypeInfos;
961  }
962 
963  /// Return a reference to the typeids encoding filters used in the current
964  /// function.
965  const std::vector<unsigned> &getFilterIds() const {
966  return FilterIds;
967  }
968 
969  /// \}
970 
971  /// Collect information used to emit debugging information of a variable.
972  void setVariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr,
973  int Slot, const DILocation *Loc) {
974  VariableDbgInfos.emplace_back(Var, Expr, Slot, Loc);
975  }
976 
977  VariableDbgInfoMapTy &getVariableDbgInfo() { return VariableDbgInfos; }
979  return VariableDbgInfos;
980  }
981 
984  assert(CallI->isCall());
985  CallSitesInfo[CallI] = std::move(CallInfo);
986  }
987 
989  return CallSitesInfo;
990  }
991 
992  /// Following functions update call site info. They should be called before
993  /// removing, replacing or copying call instruction.
994 
995  /// Move the call site info from \p Old to \New call site info. This function
996  /// is used when we are replacing one call instruction with another one to
997  /// the same callee.
998  void moveCallSiteInfo(const MachineInstr *Old,
999  const MachineInstr *New);
1000 
1001  /// Erase the call site info for \p MI. It is used to remove a call
1002  /// instruction from the instruction stream.
1003  void eraseCallSiteInfo(const MachineInstr *MI);
1004 
1005  /// Copy the call site info from \p Old to \ New. Its usage is when we are
1006  /// making a copy of the instruction that will be inserted at different point
1007  /// of the instruction stream.
1008  void copyCallSiteInfo(const MachineInstr *Old,
1009  const MachineInstr *New);
1010 };
1011 
1012 //===--------------------------------------------------------------------===//
1013 // GraphTraits specializations for function basic block graphs (CFGs)
1014 //===--------------------------------------------------------------------===//
1015 
1016 // Provide specializations of GraphTraits to be able to treat a
1017 // machine function as a graph of machine basic blocks... these are
1018 // the same as the machine basic block iterators, except that the root
1019 // node is implicitly the first node of the function.
1020 //
1021 template <> struct GraphTraits<MachineFunction*> :
1023  static NodeRef getEntryNode(MachineFunction *F) { return &F->front(); }
1024 
1025  // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
1027 
1029  return nodes_iterator(F->begin());
1030  }
1031 
1033  return nodes_iterator(F->end());
1034  }
1035 
1036  static unsigned size (MachineFunction *F) { return F->size(); }
1037 };
1038 template <> struct GraphTraits<const MachineFunction*> :
1040  static NodeRef getEntryNode(const MachineFunction *F) { return &F->front(); }
1041 
1042  // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
1044 
1046  return nodes_iterator(F->begin());
1047  }
1048 
1050  return nodes_iterator(F->end());
1051  }
1052 
1053  static unsigned size (const MachineFunction *F) {
1054  return F->size();
1055  }
1056 };
1057 
1058 // Provide specializations of GraphTraits to be able to treat a function as a
1059 // graph of basic blocks... and to walk it in inverse order. Inverse order for
1060 // a function is considered to be when traversing the predecessor edges of a BB
1061 // instead of the successor edges.
1062 //
1063 template <> struct GraphTraits<Inverse<MachineFunction*>> :
1066  return &G.Graph->front();
1067  }
1068 };
1069 template <> struct GraphTraits<Inverse<const MachineFunction*>> :
1072  return &G.Graph->front();
1073  }
1074 };
1075 
1076 } // end namespace llvm
1077 
1078 #endif // LLVM_CODEGEN_MACHINEFUNCTION_H
void push_front(MachineBasicBlock *MBB)
Pass interface - Implemented by all &#39;passes&#39;.
Definition: Pass.h:80
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: SmallVector.h:118
ArrayRef< std::pair< MCSymbol *, MDNode * > > getCodeViewAnnotations() const
unsigned getInstructionCount() const
Return the number of MachineInstrs in this MachineFunction.
A parsed version of the target data layout string in and methods for querying it. ...
Definition: DataLayout.h:111
reference emplace_back(ArgTypes &&... Args)
Definition: SmallVector.h:641
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
bool hasCallSiteLandingPad(MCSymbol *Sym)
Return true if the landing pad Eh symbol has an associated call site.
bool isCall(QueryType Type=AnyInBundle) const
Definition: MachineInstr.h:656
typename SuperClass::const_iterator const_iterator
Definition: SmallVector.h:320
static BasicBlockListType MachineFunction::* getSublistAccess(MachineBasicBlock *)
Support for MachineBasicBlock::getNextNode().
unsigned getFunctionNumber() const
getFunctionNumber - Return a unique ID for the current function.
Atomic ordering constants.
iterator erase(iterator where)
Definition: ilist.h:265
const std::vector< MCCFIInstruction > & getFrameInstructions() const
Returns a reference to a list of cfi instructions in the function&#39;s prologue.
This class represents lattice values for constants.
Definition: AllocatorList.h:23
MachineFunctionProperties & reset(Property P)
Various leaf nodes.
Definition: ISDOpcodes.h:59
void setCallsUnwindInit(bool b)
T * allocate(Capacity Cap, AllocatorType &Allocator)
Allocate an array of at least the requested capacity.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
Align getAlignment() const
getAlignment - Return the alignment of the function.
unsigned EnableDebugEntryValues
Emit debug info about parameter&#39;s entry values.
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
void transferNodesFromList(ilist_callback_traits &OldList, Iterator, Iterator)
unsigned getNumBlockIDs() const
getNumBlockIDs - Return the number of MBB ID&#39;s allocated.
static nodes_iterator nodes_end(MachineFunction *F)
void setHasEHFunclets(bool V)
const Function * FilterOrFinally
Filter or finally function. Null indicates a catch-all.
const MachineFunctionProperties & getProperties() const
Get the function properties.
unsigned size() const
static void Cleanup(DenseMap< Instruction *, Instruction *> &NewPredicates, SetVector< Instruction *> &MaybeDead, Loop *L)
Describe properties that are true of each instruction in the target description file.
Definition: MCInstrDesc.h:179
const CallSiteInfoMap & getCallSitesInfo() const
unsigned getCallSiteBeginLabel(MCSymbol *BeginLabel) const
Get the call site number for a begin label.
bool test(unsigned Idx) const
Definition: BitVector.h:501
Template traits for intrusive list.
Definition: ilist.h:89
void sort(Comp comp)
A debug info location.
Definition: DebugLoc.h:33
Metadata node.
Definition: Metadata.h:863
F(f)
MachineModuleInfo & getMMI() const
static unsigned InstrCount
static NodeRef getEntryNode(Inverse< MachineFunction *> G)
void resetDelegate(Delegate *delegate)
Reset the currently registered delegate - otherwise assert.
static nodes_iterator nodes_begin(const MachineFunction *F)
const MachineConstantPool * getConstantPool() const
VariableDbgInfoMapTy & getVariableDbgInfo()
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
const std::vector< unsigned > & getFilterIds() const
Return a reference to the typeids encoding filters used in the current function.
static nodes_iterator nodes_begin(MachineFunction *F)
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
The address of a basic block.
Definition: Constants.h:839
void setAlignment(Align A)
setAlignment - Set the alignment of the function.
A description of a memory reference used in the backend.
MachineJumpTableInfo * getJumpTableInfo()
SmallVector< MCSymbol *, 1 > EndLabels
static unsigned addLiveIn(MachineFunction &MF, unsigned PReg, const TargetRegisterClass *RC)
SmallVector< SEHHandler, 1 > SEHHandlers
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:41
static StringRef getName(Value *V)
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
const_iterator end() const
SmallVectorImpl< unsigned > & getCallSiteLandingPad(MCSymbol *Sym)
Get the call site indexes for a landing pad EH symbol.
AtomicOrdering
Atomic ordering for LLVM&#39;s memory model.
Structure used to represent pair of argument number after call lowering and register used to transfer...
Context object for machine code objects.
Definition: MCContext.h:65
This structure is used to retain landing pad info for the current function.
SlotIndexes pass.
Definition: SlotIndexes.h:314
void erase(MachineBasicBlock *MBBI)
PseudoSourceValueManager & getPSVManager() const
void setCallSiteBeginLabel(MCSymbol *BeginLabel, unsigned Site)
Map the begin label for a call site.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:32
const MachineFrameInfo & getFrameInfo() const
VariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr, int Slot, const DILocation *Loc)
Debug location.
const_iterator begin() const
ArgRegPair(unsigned R, unsigned Arg)
bool hasCallSiteBeginLabel(MCSymbol *BeginLabel) const
Return true if the begin label has a call site number associated with it.
BasicBlockListType::iterator iterator
iterator find(const_arg_type_t< KeyT > Val)
Definition: DenseMap.h:150
ArrayRecycler< MachineOperand >::Capacity OperandCapacity
MCContext & getContext() const
Use delete by default for iplist and ilist.
Definition: ilist.h:40
void setHasEHScopes(bool V)
void setDelegate(Delegate *delegate)
Set the delegate.
#define P(N)
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:432
typename MachineBasicBlock *::UnknownGraphTypeError NodeRef
Definition: GraphTraits.h:78
MachineBasicBlock * getBlockNumbered(unsigned N) const
getBlockNumbered - MachineBasicBlocks are automatically numbered when they are inserted into the mach...
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
LLVM Basic Block Representation.
Definition: BasicBlock.h:57
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
void ensureAlignment(Align A)
ensureAlignment - Make sure the function is at least A bytes aligned.
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:141
void push_front(pointer val)
Definition: ilist.h:310
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
bool hasEHFunclets() const
SmallVector< MCSymbol *, 1 > BeginLabels
static NodeRef getEntryNode(MachineFunction *F)
std::reverse_iterator< iterator > reverse_iterator
Definition: SmallVector.h:119
const_reverse_iterator rend() const
const MachineRegisterInfo & getRegInfo() const
bool verifyRequiredProperties(const MachineFunctionProperties &V) const
void splice(iterator where, iplist_impl &L2)
Definition: ilist.h:327
std::vector< int > TypeIds
void addCallArgsForwardingRegs(const MachineInstr *CallI, CallSiteInfoImpl &&CallInfo)
This class describes a target machine that is implemented with the LLVM target-independent code gener...
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
ArrayRef< std::tuple< MCSymbol *, MCSymbol *, const DIType * > > getCodeViewHeapAllocSites() const
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
void setHasInlineAsm(bool B)
Set a flag that indicates that the function contains inline assembly.
void splice(iterator InsertPt, iterator MBBI, iterator MBBE)
WinEHFuncInfo * getWinEHFuncInfo()
MachineConstantPool * getConstantPool()
getConstantPool - Return the constant pool object for the current function.
const Ty * getInfo() const
const MachineBasicBlock & front() const
MachineBasicBlock & back()
An intrusive list with ownership and callbacks specified/controlled by ilist_traits, only with API safe for polymorphic types.
Definition: ilist.h:388
This class contains a discriminated union of information about pointers in memory operands...
bool verify(const TargetRegisterInfo &TRI) const
Check that information hold by this instance make sense for the given TRI.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:40
const STC & getSubtarget() const
getSubtarget - This method returns a pointer to the specified type of TargetSubtargetInfo.
const std::vector< LandingPadInfo > & getLandingPads() const
Return a reference to the landing pad info for the current function.
Basic Register Allocator
print lazy value Lazy Value Info Printer Pass
Iterator for intrusive lists based on ilist_node.
const GraphType & Graph
Definition: GraphTraits.h:96
Recycler - This class manages a linked-list of deallocated nodes and facilitates reusing deallocated ...
Definition: Recycler.h:34
void splice(iterator InsertPt, iterator MBBI)
WasmEHFuncInfo * getWasmEHFuncInfo()
MachineOperand class - Representation of each machine instruction operand.
This is a &#39;vector&#39; (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:837
unsigned getWasmLandingPadIndex(const MachineBasicBlock *LPad) const
Get the index in wasm EH for a given landing pad.
const DataFlowGraph & G
Definition: RDFGraph.cpp:202
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
Definition: Metadata.h:643
void setCallsEHReturn(bool b)
MachineFunctionProperties & getProperties()
const WinEHFuncInfo * getWinEHFuncInfo() const
getWinEHFuncInfo - Return information about how the current function uses Windows exception handling...
bool callsUnwindInit() const
static void deleteNode(NodeTy *V)
Definition: ilist.h:41
DWARF expression.
const Function & getFunction() const
Return the LLVM function that this machine code represents.
reverse_iterator rend()
bool callsEHReturn() const
void splice(iterator InsertPt, MachineBasicBlock *MBB)
MachineFunctionProperties & reset()
Reset all the properties.
Target - Wrapper for Target specific information.
void push_back(pointer val)
Definition: ilist.h:311
LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ATTRIBUTE_RETURNS_NOALIAS void * Allocate(size_t Size, Align Alignment)
Allocate space at the specified alignment.
Definition: Allocator.h:215
Synchronized with respect to all concurrently executing threads.
Definition: LLVMContext.h:54
typename SuperClass::iterator iterator
Definition: SmallVector.h:319
static void clear(coro::Shape &Shape)
Definition: Coroutines.cpp:225
static unsigned size(MachineFunction *F)
MachineBasicBlock * LandingPadBlock
FunctionNumber(functionNumber)
Definition: LLParser.cpp:2829
Flags
Flags values. These may be or&#39;d together.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
MachineFunctionProperties & set(Property P)
TargetSubtargetInfo - Generic base class for all target subtargets.
const WasmEHFuncInfo * getWasmEHFuncInfo() const
getWasmEHFuncInfo - Return information about how the current function uses Wasm exception handling...
Representation of each machine instruction.
Definition: MachineInstr.h:63
pointer remove(iterator &IT)
Definition: ilist.h:249
static Ty * create(BumpPtrAllocator &Allocator, MachineFunction &MF)
Factory function: default behavior is to call new using the supplied allocator.
void reset()
Reset the instance as if it was just created.
iterator insert(iterator where, pointer New)
Definition: ilist.h:226
static unsigned size(const MachineFunction *F)
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
bool exposesReturnsTwice() const
exposesReturnsTwice - Returns true if the function calls setjmp or any other similar functions with a...
LandingPadInfo(MachineBasicBlock *MBB)
TargetOptions Options
#define I(x, y, z)
Definition: MD5.cpp:58
#define N
bool hasInlineAsm() const
Returns true if the function contains any inline assembly.
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
iterator end()
Definition: DenseMap.h:82
const MachineBasicBlock & back() const
MachineBasicBlock & front()
uint32_t Size
Definition: Profile.cpp:46
void setExposesReturnsTwice(bool B)
setCallsSetJmp - Set a flag that indicates if there&#39;s a call to a "returns twice" function...
void removeFromMBBNumbering(unsigned N)
removeFromMBBNumbering - Remove the specific machine basic block from our tracker, this is only really to be used by the MachineBasicBlock implementation.
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
bool hasWasmLandingPadIndex(const MachineBasicBlock *LPad) const
Returns true if the landing pad has an associate index in wasm EH.
size_type count(const_arg_type_t< KeyT > Val) const
Return 1 if the specified key is in the map, 0 otherwise.
Definition: DenseMap.h:145
ValueT lookup(const_arg_type_t< KeyT > Val) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
Definition: DenseMap.h:185
#define LLVM_NODISCARD
LLVM_NODISCARD - Warn if a type or return value is discarded.
Definition: Compiler.h:153
void setWasmLandingPadIndex(const MachineBasicBlock *LPad, unsigned Index)
Map the landing pad to its index. Used for Wasm exception handling.
static NodeRef getEntryNode(const MachineFunction *F)
void erase(iterator MBBI)
const_reverse_iterator rbegin() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool hasProperty(Property P) const
void insert(iterator MBBI, MachineBasicBlock *MBB)
static nodes_iterator nodes_end(const MachineFunction *F)
MachineFunctionProperties & reset(const MachineFunctionProperties &MFP)
aarch64 promote const
unsigned addToMBBNumbering(MachineBasicBlock *MBB)
Adds the MBB to the internal numbering.
void deallocateOperandArray(OperandCapacity Cap, MachineOperand *Array)
Dellocate an array of MachineOperands and recycle the memory.
static MachineMemOperand * getMachineMemOperand(MachineFunction &MF, FrameIndexSDNode &FI)
void push_back(MachineBasicBlock *MBB)
const BlockAddress * RecoverBA
Address of block to recover at. Null for a finally handler.
static NodeRef getEntryNode(Inverse< const MachineFunction *> G)
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:45
Callbacks do nothing by default in iplist and ilist.
Definition: ilist.h:64
const VariableDbgInfoMapTy & getVariableDbgInfo() const
void deallocate(Capacity Cap, T *Ptr)
Deallocate an array with the specified Capacity.
IRTranslator LLVM IR MI
Manages creation of pseudo source values.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
void addCodeViewAnnotation(MCSymbol *Label, MDNode *MD)
Record annotations associated with a particular label.
const std::vector< const GlobalValue * > & getTypeInfos() const
Return a reference to the C++ typeinfo for the current function.
const MachineJumpTableInfo * getJumpTableInfo() const
getJumpTableInfo - Return the jump table info object for the current function.
void setVariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr, int Slot, const DILocation *Loc)
Collect information used to emit debugging information of a variable.
reverse_iterator rbegin()
VariableDbgInfoMapTy VariableDbgInfos
MachineOperand * allocateOperandArray(OperandCapacity Cap)
Allocate an array of MachineOperands.
Properties which a MachineFunction may have at a given point in time.
This class contains meta information specific to a module.