LLVM  9.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"
39 #include <cassert>
40 #include <cstdint>
41 #include <memory>
42 #include <utility>
43 #include <vector>
44 
45 namespace llvm {
46 
47 class BasicBlock;
48 class BlockAddress;
49 class DataLayout;
50 class DebugLoc;
51 class DIExpression;
52 class DILocalVariable;
53 class DILocation;
54 class Function;
55 class GlobalValue;
56 class LLVMTargetMachine;
57 class MachineConstantPool;
58 class MachineFrameInfo;
59 class MachineFunction;
60 class MachineJumpTableInfo;
61 class MachineModuleInfo;
62 class MachineRegisterInfo;
63 class MCContext;
64 class MCInstrDesc;
65 class MCSymbol;
66 class Pass;
67 class PseudoSourceValueManager;
68 class raw_ostream;
69 class SlotIndexes;
70 class TargetRegisterClass;
71 class TargetSubtargetInfo;
72 struct WasmEHFuncInfo;
73 struct WinEHFuncInfo;
74 
76  void deleteNode(MachineBasicBlock *MBB);
77 };
78 
80  void addNodeToList(MachineBasicBlock* N);
81  void removeNodeFromList(MachineBasicBlock* N);
82 
83  template <class Iterator>
84  void transferNodesFromList(ilist_callback_traits &OldList, Iterator, Iterator) {
85  assert(this == &OldList && "never transfer MBBs between functions");
86  }
87 };
88 
89 /// MachineFunctionInfo - This class can be derived from and used by targets to
90 /// hold private target-specific information for each MachineFunction. Objects
91 /// of type are accessed/created with MF::getInfo and destroyed when the
92 /// MachineFunction is destroyed.
94  virtual ~MachineFunctionInfo();
95 
96  /// Factory function: default behavior is to call new using the
97  /// supplied allocator.
98  ///
99  /// This function can be overridden in a derive class.
100  template<typename Ty>
102  return new (Allocator.Allocate<Ty>()) Ty(MF);
103  }
104 };
105 
106 /// Properties which a MachineFunction may have at a given point in time.
107 /// Each of these has checking code in the MachineVerifier, and passes can
108 /// require that a property be set.
110  // Possible TODO: Allow targets to extend this (perhaps by allowing the
111  // constructor to specify the size of the bit vector)
112  // Possible TODO: Allow requiring the negative (e.g. VRegsAllocated could be
113  // stated as the negative of "has vregs"
114 
115 public:
116  // The properties are stated in "positive" form; i.e. a pass could require
117  // that the property hold, but not that it does not hold.
118 
119  // Property descriptions:
120  // IsSSA: True when the machine function is in SSA form and virtual registers
121  // have a single def.
122  // NoPHIs: The machine function does not contain any PHI instruction.
123  // TracksLiveness: True when tracking register liveness accurately.
124  // While this property is set, register liveness information in basic block
125  // live-in lists and machine instruction operands (e.g. kill flags, implicit
126  // defs) is accurate. This means it can be used to change the code in ways
127  // that affect the values in registers, for example by the register
128  // scavenger.
129  // When this property is clear, liveness is no longer reliable.
130  // NoVRegs: The machine function does not use any virtual registers.
131  // Legalized: In GlobalISel: the MachineLegalizer ran and all pre-isel generic
132  // instructions have been legalized; i.e., all instructions are now one of:
133  // - generic and always legal (e.g., COPY)
134  // - target-specific
135  // - legal pre-isel generic instructions.
136  // RegBankSelected: In GlobalISel: the RegBankSelect pass ran and all generic
137  // virtual registers have been assigned to a register bank.
138  // Selected: In GlobalISel: the InstructionSelect pass ran and all pre-isel
139  // generic instructions have been eliminated; i.e., all instructions are now
140  // target-specific or non-pre-isel generic instructions (e.g., COPY).
141  // Since only pre-isel generic instructions can have generic virtual register
142  // operands, this also means that all generic virtual registers have been
143  // constrained to virtual registers (assigned to register classes) and that
144  // all sizes attached to them have been eliminated.
145  enum class Property : unsigned {
146  IsSSA,
147  NoPHIs,
148  TracksLiveness,
149  NoVRegs,
150  FailedISel,
151  Legalized,
152  RegBankSelected,
153  Selected,
154  LastProperty = Selected,
155  };
156 
157  bool hasProperty(Property P) const {
158  return Properties[static_cast<unsigned>(P)];
159  }
160 
162  Properties.set(static_cast<unsigned>(P));
163  return *this;
164  }
165 
167  Properties.reset(static_cast<unsigned>(P));
168  return *this;
169  }
170 
171  /// Reset all the properties.
173  Properties.reset();
174  return *this;
175  }
176 
178  Properties |= MFP.Properties;
179  return *this;
180  }
181 
183  Properties.reset(MFP.Properties);
184  return *this;
185  }
186 
187  // Returns true if all properties set in V (i.e. required by a pass) are set
188  // in this.
190  return !V.Properties.test(Properties);
191  }
192 
193  /// Print the MachineFunctionProperties in human-readable form.
194  void print(raw_ostream &OS) const;
195 
196 private:
197  BitVector Properties =
198  BitVector(static_cast<unsigned>(Property::LastProperty)+1);
199 };
200 
201 struct SEHHandler {
202  /// Filter or finally function. Null indicates a catch-all.
204 
205  /// Address of block to recover at. Null for a finally handler.
207 };
208 
209 /// This structure is used to retain landing pad info for the current function.
211  MachineBasicBlock *LandingPadBlock; // Landing pad block.
212  SmallVector<MCSymbol *, 1> BeginLabels; // Labels prior to invoke.
213  SmallVector<MCSymbol *, 1> EndLabels; // Labels after invoke.
214  SmallVector<SEHHandler, 1> SEHHandlers; // SEH handlers active at this lpad.
215  MCSymbol *LandingPadLabel = nullptr; // Label at beginning of landing pad.
216  std::vector<int> TypeIds; // List of type ids (filters negative).
217 
219  : LandingPadBlock(MBB) {}
220 };
221 
223  const Function &F;
224  const LLVMTargetMachine &Target;
225  const TargetSubtargetInfo *STI;
226  MCContext &Ctx;
227  MachineModuleInfo &MMI;
228 
229  // RegInfo - Information about each register in use in the function.
230  MachineRegisterInfo *RegInfo;
231 
232  // Used to keep track of target-specific per-machine function information for
233  // the target implementation.
234  MachineFunctionInfo *MFInfo;
235 
236  // Keep track of objects allocated on the stack.
237  MachineFrameInfo *FrameInfo;
238 
239  // Keep track of constants which are spilled to memory
241 
242  // Keep track of jump tables for switch instructions
243  MachineJumpTableInfo *JumpTableInfo;
244 
245  // Keeps track of Wasm exception handling related data. This will be null for
246  // functions that aren't using a wasm EH personality.
247  WasmEHFuncInfo *WasmEHInfo = nullptr;
248 
249  // Keeps track of Windows exception handling related data. This will be null
250  // for functions that aren't using a funclet-based EH personality.
251  WinEHFuncInfo *WinEHInfo = nullptr;
252 
253  // Function-level unique numbering for MachineBasicBlocks. When a
254  // MachineBasicBlock is inserted into a MachineFunction is it automatically
255  // numbered and this vector keeps track of the mapping from ID's to MBB's.
256  std::vector<MachineBasicBlock*> MBBNumbering;
257 
258  // Pool-allocate MachineFunction-lifetime and IR objects.
260 
261  // Allocation management for instructions in function.
262  Recycler<MachineInstr> InstructionRecycler;
263 
264  // Allocation management for operand arrays on instructions.
265  ArrayRecycler<MachineOperand> OperandRecycler;
266 
267  // Allocation management for basic blocks in function.
268  Recycler<MachineBasicBlock> BasicBlockRecycler;
269 
270  // List of machine basic blocks in function
272  BasicBlockListType BasicBlocks;
273 
274  /// FunctionNumber - This provides a unique ID for each function emitted in
275  /// this translation unit.
276  ///
277  unsigned FunctionNumber;
278 
279  /// Alignment - The alignment of the function.
280  unsigned Alignment;
281 
282  /// ExposesReturnsTwice - True if the function calls setjmp or related
283  /// functions with attribute "returns twice", but doesn't have
284  /// the attribute itself.
285  /// This is used to limit optimizations which cannot reason
286  /// about the control flow of such functions.
287  bool ExposesReturnsTwice = false;
288 
289  /// True if the function includes any inline assembly.
290  bool HasInlineAsm = false;
291 
292  /// True if any WinCFI instruction have been emitted in this function.
293  bool HasWinCFI = false;
294 
295  /// Current high-level properties of the IR of the function (e.g. is in SSA
296  /// form or whether registers have been allocated)
297  MachineFunctionProperties Properties;
298 
299  // Allocation management for pseudo source values.
300  std::unique_ptr<PseudoSourceValueManager> PSVManager;
301 
302  /// List of moves done by a function's prolog. Used to construct frame maps
303  /// by debug and exception handling consumers.
304  std::vector<MCCFIInstruction> FrameInstructions;
305 
306  /// \name Exception Handling
307  /// \{
308 
309  /// List of LandingPadInfo describing the landing pad information.
310  std::vector<LandingPadInfo> LandingPads;
311 
312  /// Map a landing pad's EH symbol to the call site indexes.
314 
315  /// Map a landing pad to its index.
317 
318  /// Map of invoke call site index values to associated begin EH_LABEL.
319  DenseMap<MCSymbol*, unsigned> CallSiteMap;
320 
321  /// CodeView label annotations.
322  std::vector<std::pair<MCSymbol *, MDNode *>> CodeViewAnnotations;
323 
324  /// CodeView heapallocsites.
325  std::vector<std::tuple<MCSymbol*, MCSymbol*, DIType*>>
326  CodeViewHeapAllocSites;
327 
328  bool CallsEHReturn = false;
329  bool CallsUnwindInit = false;
330  bool HasEHScopes = false;
331  bool HasEHFunclets = false;
332 
333  /// List of C++ TypeInfo used.
334  std::vector<const GlobalValue *> TypeInfos;
335 
336  /// List of typeids encoding filters used.
337  std::vector<unsigned> FilterIds;
338 
339  /// List of the indices in FilterIds corresponding to filter terminators.
340  std::vector<unsigned> FilterEnds;
341 
342  EHPersonality PersonalityTypeCache = EHPersonality::Unknown;
343 
344  /// \}
345 
346  /// Clear all the members of this MachineFunction, but the ones used
347  /// to initialize again the MachineFunction.
348  /// More specifically, this deallocates all the dynamically allocated
349  /// objects and get rid of all the XXXInfo data structure, but keep
350  /// unchanged the references to Fn, Target, MMI, and FunctionNumber.
351  void clear();
352  /// Allocate and initialize the different members.
353  /// In particular, the XXXInfo data structure.
354  /// \pre Fn, Target, MMI, and FunctionNumber are properly set.
355  void init();
356 
357 public:
361  // The Slot can be negative for fixed stack objects.
362  int Slot;
363  const DILocation *Loc;
364 
366  int Slot, const DILocation *Loc)
367  : Var(Var), Expr(Expr), Slot(Slot), Loc(Loc) {}
368  };
369 
370  class Delegate {
371  virtual void anchor();
372 
373  public:
374  virtual ~Delegate() = default;
375  /// Callback after an insertion. This should not modify the MI directly.
376  virtual void MF_HandleInsertion(MachineInstr &MI) = 0;
377  /// Callback before a removal. This should not modify the MI directly.
378  virtual void MF_HandleRemoval(MachineInstr &MI) = 0;
379  };
380 
381 private:
382  Delegate *TheDelegate = nullptr;
383 
384  // Callbacks for insertion and removal.
385  void handleInsertion(MachineInstr &MI);
386  void handleRemoval(MachineInstr &MI);
387  friend struct ilist_traits<MachineInstr>;
388 
389 public:
392 
393  MachineFunction(const Function &F, const LLVMTargetMachine &Target,
394  const TargetSubtargetInfo &STI, unsigned FunctionNum,
395  MachineModuleInfo &MMI);
396  MachineFunction(const MachineFunction &) = delete;
397  MachineFunction &operator=(const MachineFunction &) = delete;
398  ~MachineFunction();
399 
400  /// Reset the instance as if it was just created.
401  void reset() {
402  clear();
403  init();
404  }
405 
406  /// Reset the currently registered delegate - otherwise assert.
407  void resetDelegate(Delegate *delegate) {
408  assert(TheDelegate == delegate &&
409  "Only the current delegate can perform reset!");
410  TheDelegate = nullptr;
411  }
412 
413  /// Set the delegate. resetDelegate must be called before attempting
414  /// to set.
415  void setDelegate(Delegate *delegate) {
416  assert(delegate && !TheDelegate &&
417  "Attempted to set delegate to null, or to change it without "
418  "first resetting it!");
419 
420  TheDelegate = delegate;
421  }
422 
423  MachineModuleInfo &getMMI() const { return MMI; }
424  MCContext &getContext() const { return Ctx; }
425 
426  PseudoSourceValueManager &getPSVManager() const { return *PSVManager; }
427 
428  /// Return the DataLayout attached to the Module associated to this MF.
429  const DataLayout &getDataLayout() const;
430 
431  /// Return the LLVM function that this machine code represents
432  const Function &getFunction() const { return F; }
433 
434  /// getName - Return the name of the corresponding LLVM function.
435  StringRef getName() const;
436 
437  /// getFunctionNumber - Return a unique ID for the current function.
438  unsigned getFunctionNumber() const { return FunctionNumber; }
439 
440  /// getTarget - Return the target machine this machine code is compiled with
441  const LLVMTargetMachine &getTarget() const { return Target; }
442 
443  /// getSubtarget - Return the subtarget for which this machine code is being
444  /// compiled.
445  const TargetSubtargetInfo &getSubtarget() const { return *STI; }
446 
447  /// getSubtarget - This method returns a pointer to the specified type of
448  /// TargetSubtargetInfo. In debug builds, it verifies that the object being
449  /// returned is of the correct type.
450  template<typename STC> const STC &getSubtarget() const {
451  return *static_cast<const STC *>(STI);
452  }
453 
454  /// getRegInfo - Return information about the registers currently in use.
455  MachineRegisterInfo &getRegInfo() { return *RegInfo; }
456  const MachineRegisterInfo &getRegInfo() const { return *RegInfo; }
457 
458  /// getFrameInfo - Return the frame info object for the current function.
459  /// This object contains information about objects allocated on the stack
460  /// frame of the current function in an abstract way.
461  MachineFrameInfo &getFrameInfo() { return *FrameInfo; }
462  const MachineFrameInfo &getFrameInfo() const { return *FrameInfo; }
463 
464  /// getJumpTableInfo - Return the jump table info object for the current
465  /// function. This object contains information about jump tables in the
466  /// current function. If the current function has no jump tables, this will
467  /// return null.
468  const MachineJumpTableInfo *getJumpTableInfo() const { return JumpTableInfo; }
469  MachineJumpTableInfo *getJumpTableInfo() { return JumpTableInfo; }
470 
471  /// getOrCreateJumpTableInfo - Get the JumpTableInfo for this function, if it
472  /// does already exist, allocate one.
473  MachineJumpTableInfo *getOrCreateJumpTableInfo(unsigned JTEntryKind);
474 
475  /// getConstantPool - Return the constant pool object for the current
476  /// function.
479 
480  /// getWasmEHFuncInfo - Return information about how the current function uses
481  /// Wasm exception handling. Returns null for functions that don't use wasm
482  /// exception handling.
483  const WasmEHFuncInfo *getWasmEHFuncInfo() const { return WasmEHInfo; }
484  WasmEHFuncInfo *getWasmEHFuncInfo() { return WasmEHInfo; }
485 
486  /// getWinEHFuncInfo - Return information about how the current function uses
487  /// Windows exception handling. Returns null for functions that don't use
488  /// funclets for exception handling.
489  const WinEHFuncInfo *getWinEHFuncInfo() const { return WinEHInfo; }
490  WinEHFuncInfo *getWinEHFuncInfo() { return WinEHInfo; }
491 
492  /// getAlignment - Return the alignment (log2, not bytes) of the function.
493  unsigned getAlignment() const { return Alignment; }
494 
495  /// setAlignment - Set the alignment (log2, not bytes) of the function.
496  void setAlignment(unsigned A) { Alignment = A; }
497 
498  /// ensureAlignment - Make sure the function is at least 1 << A bytes aligned.
499  void ensureAlignment(unsigned A) {
500  if (Alignment < A) Alignment = A;
501  }
502 
503  /// exposesReturnsTwice - Returns true if the function calls setjmp or
504  /// any other similar functions with attribute "returns twice" without
505  /// having the attribute itself.
506  bool exposesReturnsTwice() const {
507  return ExposesReturnsTwice;
508  }
509 
510  /// setCallsSetJmp - Set a flag that indicates if there's a call to
511  /// a "returns twice" function.
513  ExposesReturnsTwice = B;
514  }
515 
516  /// Returns true if the function contains any inline assembly.
517  bool hasInlineAsm() const {
518  return HasInlineAsm;
519  }
520 
521  /// Set a flag that indicates that the function contains inline assembly.
522  void setHasInlineAsm(bool B) {
523  HasInlineAsm = B;
524  }
525 
526  bool hasWinCFI() const {
527  return HasWinCFI;
528  }
529  void setHasWinCFI(bool v) { HasWinCFI = v; }
530 
531  /// Get the function properties
532  const MachineFunctionProperties &getProperties() const { return Properties; }
533  MachineFunctionProperties &getProperties() { return Properties; }
534 
535  /// getInfo - Keep track of various per-function pieces of information for
536  /// backends that would like to do so.
537  ///
538  template<typename Ty>
539  Ty *getInfo() {
540  if (!MFInfo)
541  MFInfo = Ty::template create<Ty>(Allocator, *this);
542  return static_cast<Ty*>(MFInfo);
543  }
544 
545  template<typename Ty>
546  const Ty *getInfo() const {
547  return const_cast<MachineFunction*>(this)->getInfo<Ty>();
548  }
549 
550  /// getBlockNumbered - MachineBasicBlocks are automatically numbered when they
551  /// are inserted into the machine function. The block number for a machine
552  /// basic block can be found by using the MBB::getNumber method, this method
553  /// provides the inverse mapping.
555  assert(N < MBBNumbering.size() && "Illegal block number");
556  assert(MBBNumbering[N] && "Block was removed from the machine function!");
557  return MBBNumbering[N];
558  }
559 
560  /// Should we be emitting segmented stack stuff for the function
561  bool shouldSplitStack() const;
562 
563  /// getNumBlockIDs - Return the number of MBB ID's allocated.
564  unsigned getNumBlockIDs() const { return (unsigned)MBBNumbering.size(); }
565 
566  /// RenumberBlocks - This discards all of the MachineBasicBlock numbers and
567  /// recomputes them. This guarantees that the MBB numbers are sequential,
568  /// dense, and match the ordering of the blocks within the function. If a
569  /// specific MachineBasicBlock is specified, only that block and those after
570  /// it are renumbered.
571  void RenumberBlocks(MachineBasicBlock *MBBFrom = nullptr);
572 
573  /// print - Print out the MachineFunction in a format suitable for debugging
574  /// to the specified stream.
575  void print(raw_ostream &OS, const SlotIndexes* = nullptr) const;
576 
577  /// viewCFG - This function is meant for use from the debugger. You can just
578  /// say 'call F->viewCFG()' and a ghostview window should pop up from the
579  /// program, displaying the CFG of the current function with the code for each
580  /// basic block inside. This depends on there being a 'dot' and 'gv' program
581  /// in your path.
582  void viewCFG() const;
583 
584  /// viewCFGOnly - This function is meant for use from the debugger. It works
585  /// just like viewCFG, but it does not include the contents of basic blocks
586  /// into the nodes, just the label. If you are only interested in the CFG
587  /// this can make the graph smaller.
588  ///
589  void viewCFGOnly() const;
590 
591  /// dump - Print the current MachineFunction to cerr, useful for debugger use.
592  void dump() const;
593 
594  /// Run the current MachineFunction through the machine code verifier, useful
595  /// for debugger use.
596  /// \returns true if no problems were found.
597  bool verify(Pass *p = nullptr, const char *Banner = nullptr,
598  bool AbortOnError = true) const;
599 
600  // Provide accessors for the MachineBasicBlock list...
601  using iterator = BasicBlockListType::iterator;
605 
606  /// Support for MachineBasicBlock::getNextNode().
609  return &MachineFunction::BasicBlocks;
610  }
611 
612  /// addLiveIn - Add the specified physical register as a live-in value and
613  /// create a corresponding virtual register for it.
614  unsigned addLiveIn(unsigned PReg, const TargetRegisterClass *RC);
615 
616  //===--------------------------------------------------------------------===//
617  // BasicBlock accessor functions.
618  //
619  iterator begin() { return BasicBlocks.begin(); }
620  const_iterator begin() const { return BasicBlocks.begin(); }
621  iterator end () { return BasicBlocks.end(); }
622  const_iterator end () const { return BasicBlocks.end(); }
623 
624  reverse_iterator rbegin() { return BasicBlocks.rbegin(); }
625  const_reverse_iterator rbegin() const { return BasicBlocks.rbegin(); }
626  reverse_iterator rend () { return BasicBlocks.rend(); }
627  const_reverse_iterator rend () const { return BasicBlocks.rend(); }
628 
629  unsigned size() const { return (unsigned)BasicBlocks.size();}
630  bool empty() const { return BasicBlocks.empty(); }
631  const MachineBasicBlock &front() const { return BasicBlocks.front(); }
632  MachineBasicBlock &front() { return BasicBlocks.front(); }
633  const MachineBasicBlock & back() const { return BasicBlocks.back(); }
634  MachineBasicBlock & back() { return BasicBlocks.back(); }
635 
636  void push_back (MachineBasicBlock *MBB) { BasicBlocks.push_back (MBB); }
637  void push_front(MachineBasicBlock *MBB) { BasicBlocks.push_front(MBB); }
638  void insert(iterator MBBI, MachineBasicBlock *MBB) {
639  BasicBlocks.insert(MBBI, MBB);
640  }
641  void splice(iterator InsertPt, iterator MBBI) {
642  BasicBlocks.splice(InsertPt, BasicBlocks, MBBI);
643  }
644  void splice(iterator InsertPt, MachineBasicBlock *MBB) {
645  BasicBlocks.splice(InsertPt, BasicBlocks, MBB);
646  }
647  void splice(iterator InsertPt, iterator MBBI, iterator MBBE) {
648  BasicBlocks.splice(InsertPt, BasicBlocks, MBBI, MBBE);
649  }
650 
651  void remove(iterator MBBI) { BasicBlocks.remove(MBBI); }
652  void remove(MachineBasicBlock *MBBI) { BasicBlocks.remove(MBBI); }
653  void erase(iterator MBBI) { BasicBlocks.erase(MBBI); }
654  void erase(MachineBasicBlock *MBBI) { BasicBlocks.erase(MBBI); }
655 
656  template <typename Comp>
657  void sort(Comp comp) {
658  BasicBlocks.sort(comp);
659  }
660 
661  /// Return the number of \p MachineInstrs in this \p MachineFunction.
662  unsigned getInstructionCount() const {
663  unsigned InstrCount = 0;
664  for (const MachineBasicBlock &MBB : BasicBlocks)
665  InstrCount += MBB.size();
666  return InstrCount;
667  }
668 
669  //===--------------------------------------------------------------------===//
670  // Internal functions used to automatically number MachineBasicBlocks
671 
672  /// Adds the MBB to the internal numbering. Returns the unique number
673  /// assigned to the MBB.
675  MBBNumbering.push_back(MBB);
676  return (unsigned)MBBNumbering.size()-1;
677  }
678 
679  /// removeFromMBBNumbering - Remove the specific machine basic block from our
680  /// tracker, this is only really to be used by the MachineBasicBlock
681  /// implementation.
682  void removeFromMBBNumbering(unsigned N) {
683  assert(N < MBBNumbering.size() && "Illegal basic block #");
684  MBBNumbering[N] = nullptr;
685  }
686 
687  /// CreateMachineInstr - Allocate a new MachineInstr. Use this instead
688  /// of `new MachineInstr'.
689  MachineInstr *CreateMachineInstr(const MCInstrDesc &MCID, const DebugLoc &DL,
690  bool NoImp = false);
691 
692  /// Create a new MachineInstr which is a copy of \p Orig, identical in all
693  /// ways except the instruction has no parent, prev, or next. Bundling flags
694  /// are reset.
695  ///
696  /// Note: Clones a single instruction, not whole instruction bundles.
697  /// Does not perform target specific adjustments; consider using
698  /// TargetInstrInfo::duplicate() instead.
699  MachineInstr *CloneMachineInstr(const MachineInstr *Orig);
700 
701  /// Clones instruction or the whole instruction bundle \p Orig and insert
702  /// into \p MBB before \p InsertBefore.
703  ///
704  /// Note: Does not perform target specific adjustments; consider using
705  /// TargetInstrInfo::duplicate() intead.
706  MachineInstr &CloneMachineInstrBundle(MachineBasicBlock &MBB,
707  MachineBasicBlock::iterator InsertBefore, const MachineInstr &Orig);
708 
709  /// DeleteMachineInstr - Delete the given MachineInstr.
710  void DeleteMachineInstr(MachineInstr *MI);
711 
712  /// CreateMachineBasicBlock - Allocate a new MachineBasicBlock. Use this
713  /// instead of `new MachineBasicBlock'.
714  MachineBasicBlock *CreateMachineBasicBlock(const BasicBlock *bb = nullptr);
715 
716  /// DeleteMachineBasicBlock - Delete the given MachineBasicBlock.
717  void DeleteMachineBasicBlock(MachineBasicBlock *MBB);
718 
719  /// getMachineMemOperand - Allocate a new MachineMemOperand.
720  /// MachineMemOperands are owned by the MachineFunction and need not be
721  /// explicitly deallocated.
723  MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, uint64_t s,
724  unsigned base_alignment, const AAMDNodes &AAInfo = AAMDNodes(),
725  const MDNode *Ranges = nullptr,
728  AtomicOrdering FailureOrdering = AtomicOrdering::NotAtomic);
729 
730  /// getMachineMemOperand - Allocate a new MachineMemOperand by copying
731  /// an existing one, adjusting by an offset and using the given size.
732  /// MachineMemOperands are owned by the MachineFunction and need not be
733  /// explicitly deallocated.
735  int64_t Offset, uint64_t Size);
736 
737  /// Allocate a new MachineMemOperand by copying an existing one,
738  /// replacing only AliasAnalysis information. MachineMemOperands are owned
739  /// by the MachineFunction and need not be explicitly deallocated.
741  const AAMDNodes &AAInfo);
742 
743  /// Allocate a new MachineMemOperand by copying an existing one,
744  /// replacing the flags. MachineMemOperands are owned
745  /// by the MachineFunction and need not be explicitly deallocated.
748 
750 
751  /// Allocate an array of MachineOperands. This is only intended for use by
752  /// internal MachineInstr functions.
754  return OperandRecycler.allocate(Cap, Allocator);
755  }
756 
757  /// Dellocate an array of MachineOperands and recycle the memory. This is
758  /// only intended for use by internal MachineInstr functions.
759  /// Cap must be the same capacity that was used to allocate the array.
761  OperandRecycler.deallocate(Cap, Array);
762  }
763 
764  /// Allocate and initialize a register mask with @p NumRegister bits.
765  uint32_t *allocateRegMask();
766 
767  /// Allocate and construct an extra info structure for a `MachineInstr`.
768  ///
769  /// This is allocated on the function's allocator and so lives the life of
770  /// the function.
771  MachineInstr::ExtraInfo *
772  createMIExtraInfo(ArrayRef<MachineMemOperand *> MMOs,
773  MCSymbol *PreInstrSymbol = nullptr,
774  MCSymbol *PostInstrSymbol = nullptr);
775 
776  /// Allocate a string and populate it with the given external symbol name.
777  const char *createExternalSymbolName(StringRef Name);
778 
779  //===--------------------------------------------------------------------===//
780  // Label Manipulation.
781 
782  /// getJTISymbol - Return the MCSymbol for the specified non-empty jump table.
783  /// If isLinkerPrivate is specified, an 'l' label is returned, otherwise a
784  /// normal 'L' label is returned.
785  MCSymbol *getJTISymbol(unsigned JTI, MCContext &Ctx,
786  bool isLinkerPrivate = false) const;
787 
788  /// getPICBaseSymbol - Return a function-local symbol to represent the PIC
789  /// base.
790  MCSymbol *getPICBaseSymbol() const;
791 
792  /// Returns a reference to a list of cfi instructions in the function's
793  /// prologue. Used to construct frame maps for debug and exception handling
794  /// comsumers.
795  const std::vector<MCCFIInstruction> &getFrameInstructions() const {
796  return FrameInstructions;
797  }
798 
799  LLVM_NODISCARD unsigned addFrameInst(const MCCFIInstruction &Inst);
800 
801  /// \name Exception Handling
802  /// \{
803 
804  bool callsEHReturn() const { return CallsEHReturn; }
805  void setCallsEHReturn(bool b) { CallsEHReturn = b; }
806 
807  bool callsUnwindInit() const { return CallsUnwindInit; }
808  void setCallsUnwindInit(bool b) { CallsUnwindInit = b; }
809 
810  bool hasEHScopes() const { return HasEHScopes; }
811  void setHasEHScopes(bool V) { HasEHScopes = V; }
812 
813  bool hasEHFunclets() const { return HasEHFunclets; }
814  void setHasEHFunclets(bool V) { HasEHFunclets = V; }
815 
816  /// Find or create an LandingPadInfo for the specified MachineBasicBlock.
817  LandingPadInfo &getOrCreateLandingPadInfo(MachineBasicBlock *LandingPad);
818 
819  /// Remap landing pad labels and remove any deleted landing pads.
820  void tidyLandingPads(DenseMap<MCSymbol *, uintptr_t> *LPMap = nullptr,
821  bool TidyIfNoBeginLabels = true);
822 
823  /// Return a reference to the landing pad info for the current function.
824  const std::vector<LandingPadInfo> &getLandingPads() const {
825  return LandingPads;
826  }
827 
828  /// Provide the begin and end labels of an invoke style call and associate it
829  /// with a try landing pad block.
830  void addInvoke(MachineBasicBlock *LandingPad,
831  MCSymbol *BeginLabel, MCSymbol *EndLabel);
832 
833  /// Add a new panding pad, and extract the exception handling information from
834  /// the landingpad instruction. Returns the label ID for the landing pad
835  /// entry.
836  MCSymbol *addLandingPad(MachineBasicBlock *LandingPad);
837 
838  /// Provide the catch typeinfo for a landing pad.
839  void addCatchTypeInfo(MachineBasicBlock *LandingPad,
841 
842  /// Provide the filter typeinfo for a landing pad.
843  void addFilterTypeInfo(MachineBasicBlock *LandingPad,
845 
846  /// Add a cleanup action for a landing pad.
847  void addCleanup(MachineBasicBlock *LandingPad);
848 
849  void addSEHCatchHandler(MachineBasicBlock *LandingPad, const Function *Filter,
850  const BlockAddress *RecoverBA);
851 
852  void addSEHCleanupHandler(MachineBasicBlock *LandingPad,
853  const Function *Cleanup);
854 
855  /// Return the type id for the specified typeinfo. This is function wide.
856  unsigned getTypeIDFor(const GlobalValue *TI);
857 
858  /// Return the id of the filter encoded by TyIds. This is function wide.
859  int getFilterIDFor(std::vector<unsigned> &TyIds);
860 
861  /// Map the landing pad's EH symbol to the call site indexes.
862  void setCallSiteLandingPad(MCSymbol *Sym, ArrayRef<unsigned> Sites);
863 
864  /// Map the landing pad to its index. Used for Wasm exception handling.
865  void setWasmLandingPadIndex(const MachineBasicBlock *LPad, unsigned Index) {
866  WasmLPadToIndexMap[LPad] = Index;
867  }
868 
869  /// Returns true if the landing pad has an associate index in wasm EH.
870  bool hasWasmLandingPadIndex(const MachineBasicBlock *LPad) const {
871  return WasmLPadToIndexMap.count(LPad);
872  }
873 
874  /// Get the index in wasm EH for a given landing pad.
875  unsigned getWasmLandingPadIndex(const MachineBasicBlock *LPad) const {
876  assert(hasWasmLandingPadIndex(LPad));
877  return WasmLPadToIndexMap.lookup(LPad);
878  }
879 
880  /// Get the call site indexes for a landing pad EH symbol.
882  assert(hasCallSiteLandingPad(Sym) &&
883  "missing call site number for landing pad!");
884  return LPadToCallSiteMap[Sym];
885  }
886 
887  /// Return true if the landing pad Eh symbol has an associated call site.
889  return !LPadToCallSiteMap[Sym].empty();
890  }
891 
892  /// Map the begin label for a call site.
893  void setCallSiteBeginLabel(MCSymbol *BeginLabel, unsigned Site) {
894  CallSiteMap[BeginLabel] = Site;
895  }
896 
897  /// Get the call site number for a begin label.
898  unsigned getCallSiteBeginLabel(MCSymbol *BeginLabel) const {
899  assert(hasCallSiteBeginLabel(BeginLabel) &&
900  "Missing call site number for EH_LABEL!");
901  return CallSiteMap.lookup(BeginLabel);
902  }
903 
904  /// Return true if the begin label has a call site number associated with it.
905  bool hasCallSiteBeginLabel(MCSymbol *BeginLabel) const {
906  return CallSiteMap.count(BeginLabel);
907  }
908 
909  /// Record annotations associated with a particular label.
911  CodeViewAnnotations.push_back({Label, MD});
912  }
913 
915  return CodeViewAnnotations;
916  }
917 
918  /// Record heapallocsites
919  void addCodeViewHeapAllocSite(MachineInstr *I, MDNode *MD);
920 
923  return CodeViewHeapAllocSites;
924  }
925 
926  /// Return a reference to the C++ typeinfo for the current function.
927  const std::vector<const GlobalValue *> &getTypeInfos() const {
928  return TypeInfos;
929  }
930 
931  /// Return a reference to the typeids encoding filters used in the current
932  /// function.
933  const std::vector<unsigned> &getFilterIds() const {
934  return FilterIds;
935  }
936 
937  /// \}
938 
939  /// Collect information used to emit debugging information of a variable.
940  void setVariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr,
941  int Slot, const DILocation *Loc) {
942  VariableDbgInfos.emplace_back(Var, Expr, Slot, Loc);
943  }
944 
945  VariableDbgInfoMapTy &getVariableDbgInfo() { return VariableDbgInfos; }
947  return VariableDbgInfos;
948  }
949 };
950 
951 //===--------------------------------------------------------------------===//
952 // GraphTraits specializations for function basic block graphs (CFGs)
953 //===--------------------------------------------------------------------===//
954 
955 // Provide specializations of GraphTraits to be able to treat a
956 // machine function as a graph of machine basic blocks... these are
957 // the same as the machine basic block iterators, except that the root
958 // node is implicitly the first node of the function.
959 //
960 template <> struct GraphTraits<MachineFunction*> :
962  static NodeRef getEntryNode(MachineFunction *F) { return &F->front(); }
963 
964  // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
966 
968  return nodes_iterator(F->begin());
969  }
970 
972  return nodes_iterator(F->end());
973  }
974 
975  static unsigned size (MachineFunction *F) { return F->size(); }
976 };
977 template <> struct GraphTraits<const MachineFunction*> :
979  static NodeRef getEntryNode(const MachineFunction *F) { return &F->front(); }
980 
981  // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
983 
985  return nodes_iterator(F->begin());
986  }
987 
989  return nodes_iterator(F->end());
990  }
991 
992  static unsigned size (const MachineFunction *F) {
993  return F->size();
994  }
995 };
996 
997 // Provide specializations of GraphTraits to be able to treat a function as a
998 // graph of basic blocks... and to walk it in inverse order. Inverse order for
999 // a function is considered to be when traversing the predecessor edges of a BB
1000 // instead of the successor edges.
1001 //
1002 template <> struct GraphTraits<Inverse<MachineFunction*>> :
1005  return &G.Graph->front();
1006  }
1007 };
1008 template <> struct GraphTraits<Inverse<const MachineFunction*>> :
1011  return &G.Graph->front();
1012  }
1013 };
1014 
1015 } // end namespace llvm
1016 
1017 #endif // LLVM_CODEGEN_MACHINEFUNCTION_H
void push_front(MachineBasicBlock *MBB)
Pass interface - Implemented by all &#39;passes&#39;.
Definition: Pass.h:80
Synchronized with respect to all concurrently executing threads.
Definition: LLVMContext.h:54
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:110
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.
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
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
Describe properties that are true of each instruction in the target description file.
Definition: MCInstrDesc.h:164
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
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
static StringRef getName(Value *V)
unsigned getAlignment() const
getAlignment - Return the alignment (log2, not bytes) of the function.
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.
Context object for machine code objects.
Definition: MCContext.h:62
ArrayRef< std::tuple< MCSymbol *, MCSymbol *, DIType * > > getCodeViewHeapAllocSites() const
This structure is used to retain landing pad info for the current function.
SlotIndexes pass.
Definition: SlotIndexes.h:328
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
bool hasCallSiteBeginLabel(MCSymbol *BeginLabel) const
Return true if the begin label has a call site number associated with it.
BasicBlockListType::iterator iterator
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.
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:140
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)
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:214
const_reverse_iterator rend() const
const MachineRegisterInfo & getRegInfo() const
void ensureAlignment(unsigned A)
ensureAlignment - Make sure the function is at least 1 << A bytes aligned.
bool verifyRequiredProperties(const MachineFunctionProperties &V) const
void splice(iterator where, iplist_impl &L2)
Definition: ilist.h:327
std::vector< int > TypeIds
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...
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.
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
static void clear(coro::Shape &Shape)
Definition: Coroutines.cpp:211
static unsigned size(MachineFunction *F)
MachineBasicBlock * LandingPadBlock
FunctionNumber(functionNumber)
Definition: LLParser.cpp:2799
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)
#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")
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:171
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:211
#define LLVM_NODISCARD
LLVM_NODISCARD - Warn if a type or return value is discarded.
Definition: Compiler.h:128
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.
void setAlignment(unsigned A)
setAlignment - Set the alignment (log2, not bytes) of the function.
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.