LLVM  16.0.0git
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/SmallVector.h"
25 #include "llvm/ADT/ilist.h"
26 #include "llvm/ADT/iterator.h"
31 #include "llvm/Support/Allocator.h"
34 #include "llvm/Support/Compiler.h"
35 #include "llvm/Support/Recycler.h"
37 #include <cassert>
38 #include <cstdint>
39 #include <memory>
40 #include <utility>
41 #include <vector>
42 
43 namespace llvm {
44 
45 class BasicBlock;
46 class BlockAddress;
47 class DataLayout;
48 class DebugLoc;
49 struct DenormalMode;
50 class DIExpression;
51 class DILocalVariable;
52 class DILocation;
53 class Function;
54 class GISelChangeObserver;
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 MCSection;
67 class Pass;
68 class PseudoSourceValueManager;
69 class raw_ostream;
70 class SlotIndexes;
71 class StringRef;
72 class TargetRegisterClass;
73 class TargetSubtargetInfo;
74 struct WasmEHFuncInfo;
75 struct WinEHFuncInfo;
76 
79 };
80 
84 
85  template <class Iterator>
86  void transferNodesFromList(ilist_callback_traits &OldList, Iterator, Iterator) {
87  assert(this == &OldList && "never transfer MBBs between functions");
88  }
89 };
90 
91 /// MachineFunctionInfo - This class can be derived from and used by targets to
92 /// hold private target-specific information for each MachineFunction. Objects
93 /// of type are accessed/created with MF::getInfo and destroyed when the
94 /// MachineFunction is destroyed.
96  virtual ~MachineFunctionInfo();
97 
98  /// Factory function: default behavior is to call new using the
99  /// supplied allocator.
100  ///
101  /// This function can be overridden in a derive class.
102  template<typename Ty>
104  return new (Allocator.Allocate<Ty>()) Ty(MF);
105  }
106 
107  template <typename Ty>
108  static Ty *create(BumpPtrAllocator &Allocator, const Ty &MFI) {
109  return new (Allocator.Allocate<Ty>()) Ty(MFI);
110  }
111 
112  /// Make a functionally equivalent copy of this MachineFunctionInfo in \p MF.
113  /// This requires remapping MachineBasicBlock references from the original
114  /// parent to values in the new function. Targets may assume that virtual
115  /// register and frame index values are preserved in the new function.
116  virtual MachineFunctionInfo *
119  const {
120  return nullptr;
121  }
122 };
123 
124 /// Properties which a MachineFunction may have at a given point in time.
125 /// Each of these has checking code in the MachineVerifier, and passes can
126 /// require that a property be set.
128  // Possible TODO: Allow targets to extend this (perhaps by allowing the
129  // constructor to specify the size of the bit vector)
130  // Possible TODO: Allow requiring the negative (e.g. VRegsAllocated could be
131  // stated as the negative of "has vregs"
132 
133 public:
134  // The properties are stated in "positive" form; i.e. a pass could require
135  // that the property hold, but not that it does not hold.
136 
137  // Property descriptions:
138  // IsSSA: True when the machine function is in SSA form and virtual registers
139  // have a single def.
140  // NoPHIs: The machine function does not contain any PHI instruction.
141  // TracksLiveness: True when tracking register liveness accurately.
142  // While this property is set, register liveness information in basic block
143  // live-in lists and machine instruction operands (e.g. implicit defs) is
144  // accurate, kill flags are conservatively accurate (kill flag correctly
145  // indicates the last use of a register, an operand without kill flag may or
146  // may not be the last use of a register). This means it can be used to
147  // change the code in ways that affect the values in registers, for example
148  // by the register scavenger.
149  // When this property is cleared at a very late time, liveness is no longer
150  // reliable.
151  // NoVRegs: The machine function does not use any virtual registers.
152  // Legalized: In GlobalISel: the MachineLegalizer ran and all pre-isel generic
153  // instructions have been legalized; i.e., all instructions are now one of:
154  // - generic and always legal (e.g., COPY)
155  // - target-specific
156  // - legal pre-isel generic instructions.
157  // RegBankSelected: In GlobalISel: the RegBankSelect pass ran and all generic
158  // virtual registers have been assigned to a register bank.
159  // Selected: In GlobalISel: the InstructionSelect pass ran and all pre-isel
160  // generic instructions have been eliminated; i.e., all instructions are now
161  // target-specific or non-pre-isel generic instructions (e.g., COPY).
162  // Since only pre-isel generic instructions can have generic virtual register
163  // operands, this also means that all generic virtual registers have been
164  // constrained to virtual registers (assigned to register classes) and that
165  // all sizes attached to them have been eliminated.
166  // TiedOpsRewritten: The twoaddressinstruction pass will set this flag, it
167  // means that tied-def have been rewritten to meet the RegConstraint.
168  // FailsVerification: Means that the function is not expected to pass machine
169  // verification. This can be set by passes that introduce known problems that
170  // have not been fixed yet.
171  // TracksDebugUserValues: Without this property enabled, debug instructions
172  // such as DBG_VALUE are allowed to reference virtual registers even if those
173  // registers do not have a definition. With the property enabled virtual
174  // registers must only be used if they have a definition. This property
175  // allows earlier passes in the pipeline to skip updates of `DBG_VALUE`
176  // instructions to save compile time.
177  enum class Property : unsigned {
178  IsSSA,
179  NoPHIs,
181  NoVRegs,
182  FailedISel,
183  Legalized,
185  Selected,
190  };
191 
192  bool hasProperty(Property P) const {
193  return Properties[static_cast<unsigned>(P)];
194  }
195 
197  Properties.set(static_cast<unsigned>(P));
198  return *this;
199  }
200 
202  Properties.reset(static_cast<unsigned>(P));
203  return *this;
204  }
205 
206  /// Reset all the properties.
208  Properties.reset();
209  return *this;
210  }
211 
213  Properties |= MFP.Properties;
214  return *this;
215  }
216 
218  Properties.reset(MFP.Properties);
219  return *this;
220  }
221 
222  // Returns true if all properties set in V (i.e. required by a pass) are set
223  // in this.
225  return !V.Properties.test(Properties);
226  }
227 
228  /// Print the MachineFunctionProperties in human-readable form.
229  void print(raw_ostream &OS) const;
230 
231 private:
232  BitVector Properties =
233  BitVector(static_cast<unsigned>(Property::LastProperty)+1);
234 };
235 
236 struct SEHHandler {
237  /// Filter or finally function. Null indicates a catch-all.
239 
240  /// Address of block to recover at. Null for a finally handler.
242 };
243 
244 /// This structure is used to retain landing pad info for the current function.
246  MachineBasicBlock *LandingPadBlock; // Landing pad block.
247  SmallVector<MCSymbol *, 1> BeginLabels; // Labels prior to invoke.
248  SmallVector<MCSymbol *, 1> EndLabels; // Labels after invoke.
249  SmallVector<SEHHandler, 1> SEHHandlers; // SEH handlers active at this lpad.
250  MCSymbol *LandingPadLabel = nullptr; // Label at beginning of landing pad.
251  std::vector<int> TypeIds; // List of type ids (filters negative).
252 
254  : LandingPadBlock(MBB) {}
255 };
256 
258  Function &F;
259  const LLVMTargetMachine &Target;
260  const TargetSubtargetInfo *STI;
261  MCContext &Ctx;
262  MachineModuleInfo &MMI;
263 
264  // RegInfo - Information about each register in use in the function.
266 
267  // Used to keep track of target-specific per-machine function information for
268  // the target implementation.
269  MachineFunctionInfo *MFInfo;
270 
271  // Keep track of objects allocated on the stack.
272  MachineFrameInfo *FrameInfo;
273 
274  // Keep track of constants which are spilled to memory
276 
277  // Keep track of jump tables for switch instructions
278  MachineJumpTableInfo *JumpTableInfo;
279 
280  // Keep track of the function section.
281  MCSection *Section = nullptr;
282 
283  // Keeps track of Wasm exception handling related data. This will be null for
284  // functions that aren't using a wasm EH personality.
285  WasmEHFuncInfo *WasmEHInfo = nullptr;
286 
287  // Keeps track of Windows exception handling related data. This will be null
288  // for functions that aren't using a funclet-based EH personality.
289  WinEHFuncInfo *WinEHInfo = nullptr;
290 
291  // Function-level unique numbering for MachineBasicBlocks. When a
292  // MachineBasicBlock is inserted into a MachineFunction is it automatically
293  // numbered and this vector keeps track of the mapping from ID's to MBB's.
294  std::vector<MachineBasicBlock*> MBBNumbering;
295 
296  // Pool-allocate MachineFunction-lifetime and IR objects.
298 
299  // Allocation management for instructions in function.
300  Recycler<MachineInstr> InstructionRecycler;
301 
302  // Allocation management for operand arrays on instructions.
303  ArrayRecycler<MachineOperand> OperandRecycler;
304 
305  // Allocation management for basic blocks in function.
306  Recycler<MachineBasicBlock> BasicBlockRecycler;
307 
308  // List of machine basic blocks in function
310  BasicBlockListType BasicBlocks;
311 
312  /// FunctionNumber - This provides a unique ID for each function emitted in
313  /// this translation unit.
314  ///
315  unsigned FunctionNumber;
316 
317  /// Alignment - The alignment of the function.
318  Align Alignment;
319 
320  /// ExposesReturnsTwice - True if the function calls setjmp or related
321  /// functions with attribute "returns twice", but doesn't have
322  /// the attribute itself.
323  /// This is used to limit optimizations which cannot reason
324  /// about the control flow of such functions.
325  bool ExposesReturnsTwice = false;
326 
327  /// True if the function includes any inline assembly.
328  bool HasInlineAsm = false;
329 
330  /// True if any WinCFI instruction have been emitted in this function.
331  bool HasWinCFI = false;
332 
333  /// Current high-level properties of the IR of the function (e.g. is in SSA
334  /// form or whether registers have been allocated)
335  MachineFunctionProperties Properties;
336 
337  // Allocation management for pseudo source values.
338  std::unique_ptr<PseudoSourceValueManager> PSVManager;
339 
340  /// List of moves done by a function's prolog. Used to construct frame maps
341  /// by debug and exception handling consumers.
342  std::vector<MCCFIInstruction> FrameInstructions;
343 
344  /// List of basic blocks immediately following calls to _setjmp. Used to
345  /// construct a table of valid longjmp targets for Windows Control Flow Guard.
346  std::vector<MCSymbol *> LongjmpTargets;
347 
348  /// List of basic blocks that are the target of catchrets. Used to construct
349  /// a table of valid targets for Windows EHCont Guard.
350  std::vector<MCSymbol *> CatchretTargets;
351 
352  /// \name Exception Handling
353  /// \{
354 
355  /// List of LandingPadInfo describing the landing pad information.
356  std::vector<LandingPadInfo> LandingPads;
357 
358  /// Map a landing pad's EH symbol to the call site indexes.
360 
361  /// Map a landing pad to its index.
363 
364  /// Map of invoke call site index values to associated begin EH_LABEL.
365  DenseMap<MCSymbol*, unsigned> CallSiteMap;
366 
367  /// CodeView label annotations.
368  std::vector<std::pair<MCSymbol *, MDNode *>> CodeViewAnnotations;
369 
370  bool CallsEHReturn = false;
371  bool CallsUnwindInit = false;
372  bool HasEHCatchret = false;
373  bool HasEHScopes = false;
374  bool HasEHFunclets = false;
375 
376  /// Section Type for basic blocks, only relevant with basic block sections.
378 
379  /// List of C++ TypeInfo used.
380  std::vector<const GlobalValue *> TypeInfos;
381 
382  /// List of typeids encoding filters used.
383  std::vector<unsigned> FilterIds;
384 
385  /// List of the indices in FilterIds corresponding to filter terminators.
386  std::vector<unsigned> FilterEnds;
387 
388  EHPersonality PersonalityTypeCache = EHPersonality::Unknown;
389 
390  /// \}
391 
392  /// Clear all the members of this MachineFunction, but the ones used
393  /// to initialize again the MachineFunction.
394  /// More specifically, this deallocates all the dynamically allocated
395  /// objects and get rid of all the XXXInfo data structure, but keep
396  /// unchanged the references to Fn, Target, MMI, and FunctionNumber.
397  void clear();
398  /// Allocate and initialize the different members.
399  /// In particular, the XXXInfo data structure.
400  /// \pre Fn, Target, MMI, and FunctionNumber are properly set.
401  void init();
402 
403 public:
407  // The Slot can be negative for fixed stack objects.
408  int Slot;
409  const DILocation *Loc;
410 
412  int Slot, const DILocation *Loc)
413  : Var(Var), Expr(Expr), Slot(Slot), Loc(Loc) {}
414  };
415 
416  class Delegate {
417  virtual void anchor();
418 
419  public:
420  virtual ~Delegate() = default;
421  /// Callback after an insertion. This should not modify the MI directly.
422  virtual void MF_HandleInsertion(MachineInstr &MI) = 0;
423  /// Callback before a removal. This should not modify the MI directly.
424  virtual void MF_HandleRemoval(MachineInstr &MI) = 0;
425  };
426 
427  /// Structure used to represent pair of argument number after call lowering
428  /// and register used to transfer that argument.
429  /// For now we support only cases when argument is transferred through one
430  /// register.
431  struct ArgRegPair {
434  ArgRegPair(Register R, unsigned Arg) : Reg(R), ArgNo(Arg) {
435  assert(Arg < (1 << 16) && "Arg out of range");
436  }
437  };
438  /// Vector of call argument and its forwarding register.
441 
442 private:
443  Delegate *TheDelegate = nullptr;
444  GISelChangeObserver *Observer = nullptr;
445 
447  /// Map a call instruction to call site arguments forwarding info.
448  CallSiteInfoMap CallSitesInfo;
449 
450  /// A helper function that returns call site info for a give call
451  /// instruction if debug entry value support is enabled.
452  CallSiteInfoMap::iterator getCallSiteInfo(const MachineInstr *MI);
453 
454  // Callbacks for insertion and removal.
455  void handleInsertion(MachineInstr &MI);
456  void handleRemoval(MachineInstr &MI);
457  friend struct ilist_traits<MachineInstr>;
458 
459 public:
462 
463  /// A count of how many instructions in the function have had numbers
464  /// assigned to them. Used for debug value tracking, to determine the
465  /// next instruction number.
466  unsigned DebugInstrNumberingCount = 0;
467 
468  /// Set value of DebugInstrNumberingCount field. Avoid using this unless
469  /// you're deserializing this data.
470  void setDebugInstrNumberingCount(unsigned Num);
471 
472  /// Pair of instruction number and operand number.
473  using DebugInstrOperandPair = std::pair<unsigned, unsigned>;
474 
475  /// Replacement definition for a debug instruction reference. Made up of a
476  /// source instruction / operand pair, destination pair, and a qualifying
477  /// subregister indicating what bits in the operand make up the substitution.
478  // For example, a debug user
479  /// of %1:
480  /// %0:gr32 = someinst, debug-instr-number 1
481  /// %1:gr16 = %0.some_16_bit_subreg, debug-instr-number 2
482  /// Would receive the substitution {{2, 0}, {1, 0}, $subreg}, where $subreg is
483  /// the subregister number for some_16_bit_subreg.
485  public:
486  DebugInstrOperandPair Src; ///< Source instruction / operand pair.
487  DebugInstrOperandPair Dest; ///< Replacement instruction / operand pair.
488  unsigned Subreg; ///< Qualifier for which part of Dest is read.
489 
491  const DebugInstrOperandPair &Dest, unsigned Subreg)
492  : Src(Src), Dest(Dest), Subreg(Subreg) {}
493 
494  /// Order only by source instruction / operand pair: there should never
495  /// be duplicate entries for the same source in any collection.
496  bool operator<(const DebugSubstitution &Other) const {
497  return Src < Other.Src;
498  }
499  };
500 
501  /// Debug value substitutions: a collection of DebugSubstitution objects,
502  /// recording changes in where a value is defined. For example, when one
503  /// instruction is substituted for another. Keeping a record allows recovery
504  /// of variable locations after compilation finishes.
506 
507  /// Location of a PHI instruction that is also a debug-info variable value,
508  /// for the duration of register allocation. Loaded by the PHI-elimination
509  /// pass, and emitted as DBG_PHI instructions during VirtRegRewriter, with
510  /// maintenance applied by intermediate passes that edit registers (such as
511  /// coalescing and the allocator passes).
513  public:
514  MachineBasicBlock *MBB; ///< Block where this PHI was originally located.
515  Register Reg; ///< VReg where the control-flow-merge happens.
516  unsigned SubReg; ///< Optional subreg qualifier within Reg.
518  : MBB(MBB), Reg(Reg), SubReg(SubReg) {}
519  };
520 
521  /// Map of debug instruction numbers to the position of their PHI instructions
522  /// during register allocation. See DebugPHIRegallocPos.
524 
525  /// Create a substitution between one <instr,operand> value to a different,
526  /// new value.
527  void makeDebugValueSubstitution(DebugInstrOperandPair, DebugInstrOperandPair,
528  unsigned SubReg = 0);
529 
530  /// Create substitutions for any tracked values in \p Old, to point at
531  /// \p New. Needed when we re-create an instruction during optimization,
532  /// which has the same signature (i.e., def operands in the same place) but
533  /// a modified instruction type, flags, or otherwise. An example: X86 moves
534  /// are sometimes transformed into equivalent LEAs.
535  /// If the two instructions are not the same opcode, limit which operands to
536  /// examine for substitutions to the first N operands by setting
537  /// \p MaxOperand.
538  void substituteDebugValuesForInst(const MachineInstr &Old, MachineInstr &New,
539  unsigned MaxOperand = UINT_MAX);
540 
541  /// Find the underlying defining instruction / operand for a COPY instruction
542  /// while in SSA form. Copies do not actually define values -- they move them
543  /// between registers. Labelling a COPY-like instruction with an instruction
544  /// number is to be avoided as it makes value numbers non-unique later in
545  /// compilation. This method follows the definition chain for any sequence of
546  /// COPY-like instructions to find whatever non-COPY-like instruction defines
547  /// the copied value; or for parameters, creates a DBG_PHI on entry.
548  /// May insert instructions into the entry block!
549  /// \p MI The copy-like instruction to salvage.
550  /// \p DbgPHICache A container to cache already-solved COPYs.
551  /// \returns An instruction/operand pair identifying the defining value.
553  salvageCopySSA(MachineInstr &MI,
555 
556  DebugInstrOperandPair salvageCopySSAImpl(MachineInstr &MI);
557 
558  /// Finalise any partially emitted debug instructions. These are DBG_INSTR_REF
559  /// instructions where we only knew the vreg of the value they use, not the
560  /// instruction that defines that vreg. Once isel finishes, we should have
561  /// enough information for every DBG_INSTR_REF to point at an instruction
562  /// (or DBG_PHI).
563  void finalizeDebugInstrRefs();
564 
565  /// Returns true if the function's variable locations should be tracked with
566  /// instruction referencing.
567  bool useDebugInstrRef() const;
568 
569  /// A reserved operand number representing the instructions memory operand,
570  /// for instructions that have a stack spill fused into them.
571  const static unsigned int DebugOperandMemNumber;
572 
574  const TargetSubtargetInfo &STI, unsigned FunctionNum,
575  MachineModuleInfo &MMI);
576  MachineFunction(const MachineFunction &) = delete;
577  MachineFunction &operator=(const MachineFunction &) = delete;
578  ~MachineFunction();
579 
580  /// Reset the instance as if it was just created.
581  void reset() {
582  clear();
583  init();
584  }
585 
586  /// Reset the currently registered delegate - otherwise assert.
587  void resetDelegate(Delegate *delegate) {
588  assert(TheDelegate == delegate &&
589  "Only the current delegate can perform reset!");
590  TheDelegate = nullptr;
591  }
592 
593  /// Set the delegate. resetDelegate must be called before attempting
594  /// to set.
595  void setDelegate(Delegate *delegate) {
596  assert(delegate && !TheDelegate &&
597  "Attempted to set delegate to null, or to change it without "
598  "first resetting it!");
599 
600  TheDelegate = delegate;
601  }
602 
603  void setObserver(GISelChangeObserver *O) { Observer = O; }
604 
605  GISelChangeObserver *getObserver() const { return Observer; }
606 
607  MachineModuleInfo &getMMI() const { return MMI; }
608  MCContext &getContext() const { return Ctx; }
609 
610  /// Returns the Section this function belongs to.
611  MCSection *getSection() const { return Section; }
612 
613  /// Indicates the Section this function belongs to.
614  void setSection(MCSection *S) { Section = S; }
615 
616  PseudoSourceValueManager &getPSVManager() const { return *PSVManager; }
617 
618  /// Return the DataLayout attached to the Module associated to this MF.
619  const DataLayout &getDataLayout() const;
620 
621  /// Return the LLVM function that this machine code represents
622  Function &getFunction() { return F; }
623 
624  /// Return the LLVM function that this machine code represents
625  const Function &getFunction() const { return F; }
626 
627  /// getName - Return the name of the corresponding LLVM function.
628  StringRef getName() const;
629 
630  /// getFunctionNumber - Return a unique ID for the current function.
631  unsigned getFunctionNumber() const { return FunctionNumber; }
632 
633  /// Returns true if this function has basic block sections enabled.
634  bool hasBBSections() const {
635  return (BBSectionsType == BasicBlockSection::All ||
636  BBSectionsType == BasicBlockSection::List ||
637  BBSectionsType == BasicBlockSection::Preset);
638  }
639 
640  /// Returns true if basic block labels are to be generated for this function.
641  bool hasBBLabels() const {
642  return BBSectionsType == BasicBlockSection::Labels;
643  }
644 
645  void setBBSectionsType(BasicBlockSection V) { BBSectionsType = V; }
646 
647  /// Assign IsBeginSection IsEndSection fields for basic blocks in this
648  /// function.
649  void assignBeginEndSections();
650 
651  /// getTarget - Return the target machine this machine code is compiled with
652  const LLVMTargetMachine &getTarget() const { return Target; }
653 
654  /// getSubtarget - Return the subtarget for which this machine code is being
655  /// compiled.
656  const TargetSubtargetInfo &getSubtarget() const { return *STI; }
657 
658  /// getSubtarget - This method returns a pointer to the specified type of
659  /// TargetSubtargetInfo. In debug builds, it verifies that the object being
660  /// returned is of the correct type.
661  template<typename STC> const STC &getSubtarget() const {
662  return *static_cast<const STC *>(STI);
663  }
664 
665  /// getRegInfo - Return information about the registers currently in use.
667  const MachineRegisterInfo &getRegInfo() const { return *RegInfo; }
668 
669  /// getFrameInfo - Return the frame info object for the current function.
670  /// This object contains information about objects allocated on the stack
671  /// frame of the current function in an abstract way.
672  MachineFrameInfo &getFrameInfo() { return *FrameInfo; }
673  const MachineFrameInfo &getFrameInfo() const { return *FrameInfo; }
674 
675  /// getJumpTableInfo - Return the jump table info object for the current
676  /// function. This object contains information about jump tables in the
677  /// current function. If the current function has no jump tables, this will
678  /// return null.
679  const MachineJumpTableInfo *getJumpTableInfo() const { return JumpTableInfo; }
680  MachineJumpTableInfo *getJumpTableInfo() { return JumpTableInfo; }
681 
682  /// getOrCreateJumpTableInfo - Get the JumpTableInfo for this function, if it
683  /// does already exist, allocate one.
684  MachineJumpTableInfo *getOrCreateJumpTableInfo(unsigned JTEntryKind);
685 
686  /// getConstantPool - Return the constant pool object for the current
687  /// function.
690 
691  /// getWasmEHFuncInfo - Return information about how the current function uses
692  /// Wasm exception handling. Returns null for functions that don't use wasm
693  /// exception handling.
694  const WasmEHFuncInfo *getWasmEHFuncInfo() const { return WasmEHInfo; }
695  WasmEHFuncInfo *getWasmEHFuncInfo() { return WasmEHInfo; }
696 
697  /// getWinEHFuncInfo - Return information about how the current function uses
698  /// Windows exception handling. Returns null for functions that don't use
699  /// funclets for exception handling.
700  const WinEHFuncInfo *getWinEHFuncInfo() const { return WinEHInfo; }
701  WinEHFuncInfo *getWinEHFuncInfo() { return WinEHInfo; }
702 
703  /// getAlignment - Return the alignment of the function.
704  Align getAlignment() const { return Alignment; }
705 
706  /// setAlignment - Set the alignment of the function.
707  void setAlignment(Align A) { Alignment = A; }
708 
709  /// ensureAlignment - Make sure the function is at least A bytes aligned.
711  if (Alignment < A)
712  Alignment = A;
713  }
714 
715  /// exposesReturnsTwice - Returns true if the function calls setjmp or
716  /// any other similar functions with attribute "returns twice" without
717  /// having the attribute itself.
718  bool exposesReturnsTwice() const {
719  return ExposesReturnsTwice;
720  }
721 
722  /// setCallsSetJmp - Set a flag that indicates if there's a call to
723  /// a "returns twice" function.
725  ExposesReturnsTwice = B;
726  }
727 
728  /// Returns true if the function contains any inline assembly.
729  bool hasInlineAsm() const {
730  return HasInlineAsm;
731  }
732 
733  /// Set a flag that indicates that the function contains inline assembly.
734  void setHasInlineAsm(bool B) {
735  HasInlineAsm = B;
736  }
737 
738  bool hasWinCFI() const {
739  return HasWinCFI;
740  }
741  void setHasWinCFI(bool v) { HasWinCFI = v; }
742 
743  /// True if this function needs frame moves for debug or exceptions.
744  bool needsFrameMoves() const;
745 
746  /// Get the function properties
747  const MachineFunctionProperties &getProperties() const { return Properties; }
748  MachineFunctionProperties &getProperties() { return Properties; }
749 
750  /// getInfo - Keep track of various per-function pieces of information for
751  /// backends that would like to do so.
752  ///
753  template<typename Ty>
754  Ty *getInfo() {
755  if (!MFInfo)
756  MFInfo = Ty::template create<Ty>(Allocator, *this);
757  return static_cast<Ty*>(MFInfo);
758  }
759 
760  template<typename Ty>
761  const Ty *getInfo() const {
762  return const_cast<MachineFunction*>(this)->getInfo<Ty>();
763  }
764 
765  template <typename Ty> Ty *cloneInfo(const Ty &Old) {
766  assert(!MFInfo);
767  MFInfo = Ty::template create<Ty>(Allocator, Old);
768  return static_cast<Ty *>(MFInfo);
769  }
770 
772  const MachineFunction &OrigMF,
774  assert(!MFInfo && "new function already has MachineFunctionInfo");
775  if (!OrigMF.MFInfo)
776  return nullptr;
777  return OrigMF.MFInfo->clone(Allocator, *this, Src2DstMBB);
778  }
779 
780  /// Returns the denormal handling type for the default rounding mode of the
781  /// function.
782  DenormalMode getDenormalMode(const fltSemantics &FPType) const;
783 
784  /// getBlockNumbered - MachineBasicBlocks are automatically numbered when they
785  /// are inserted into the machine function. The block number for a machine
786  /// basic block can be found by using the MBB::getNumber method, this method
787  /// provides the inverse mapping.
789  assert(N < MBBNumbering.size() && "Illegal block number");
790  assert(MBBNumbering[N] && "Block was removed from the machine function!");
791  return MBBNumbering[N];
792  }
793 
794  /// Should we be emitting segmented stack stuff for the function
795  bool shouldSplitStack() const;
796 
797  /// getNumBlockIDs - Return the number of MBB ID's allocated.
798  unsigned getNumBlockIDs() const { return (unsigned)MBBNumbering.size(); }
799 
800  /// RenumberBlocks - This discards all of the MachineBasicBlock numbers and
801  /// recomputes them. This guarantees that the MBB numbers are sequential,
802  /// dense, and match the ordering of the blocks within the function. If a
803  /// specific MachineBasicBlock is specified, only that block and those after
804  /// it are renumbered.
805  void RenumberBlocks(MachineBasicBlock *MBBFrom = nullptr);
806 
807  /// print - Print out the MachineFunction in a format suitable for debugging
808  /// to the specified stream.
809  void print(raw_ostream &OS, const SlotIndexes* = nullptr) const;
810 
811  /// viewCFG - This function is meant for use from the debugger. You can just
812  /// say 'call F->viewCFG()' and a ghostview window should pop up from the
813  /// program, displaying the CFG of the current function with the code for each
814  /// basic block inside. This depends on there being a 'dot' and 'gv' program
815  /// in your path.
816  void viewCFG() const;
817 
818  /// viewCFGOnly - This function is meant for use from the debugger. It works
819  /// just like viewCFG, but it does not include the contents of basic blocks
820  /// into the nodes, just the label. If you are only interested in the CFG
821  /// this can make the graph smaller.
822  ///
823  void viewCFGOnly() const;
824 
825  /// dump - Print the current MachineFunction to cerr, useful for debugger use.
826  void dump() const;
827 
828  /// Run the current MachineFunction through the machine code verifier, useful
829  /// for debugger use.
830  /// \returns true if no problems were found.
831  bool verify(Pass *p = nullptr, const char *Banner = nullptr,
832  bool AbortOnError = true) const;
833 
834  // Provide accessors for the MachineBasicBlock list...
839 
840  /// Support for MachineBasicBlock::getNextNode().
843  return &MachineFunction::BasicBlocks;
844  }
845 
846  /// addLiveIn - Add the specified physical register as a live-in value and
847  /// create a corresponding virtual register for it.
849 
850  //===--------------------------------------------------------------------===//
851  // BasicBlock accessor functions.
852  //
853  iterator begin() { return BasicBlocks.begin(); }
854  const_iterator begin() const { return BasicBlocks.begin(); }
855  iterator end () { return BasicBlocks.end(); }
856  const_iterator end () const { return BasicBlocks.end(); }
857 
858  reverse_iterator rbegin() { return BasicBlocks.rbegin(); }
859  const_reverse_iterator rbegin() const { return BasicBlocks.rbegin(); }
860  reverse_iterator rend () { return BasicBlocks.rend(); }
861  const_reverse_iterator rend () const { return BasicBlocks.rend(); }
862 
863  unsigned size() const { return (unsigned)BasicBlocks.size();}
864  bool empty() const { return BasicBlocks.empty(); }
865  const MachineBasicBlock &front() const { return BasicBlocks.front(); }
866  MachineBasicBlock &front() { return BasicBlocks.front(); }
867  const MachineBasicBlock & back() const { return BasicBlocks.back(); }
868  MachineBasicBlock & back() { return BasicBlocks.back(); }
869 
870  void push_back (MachineBasicBlock *MBB) { BasicBlocks.push_back (MBB); }
871  void push_front(MachineBasicBlock *MBB) { BasicBlocks.push_front(MBB); }
873  BasicBlocks.insert(MBBI, MBB);
874  }
875  void splice(iterator InsertPt, iterator MBBI) {
876  BasicBlocks.splice(InsertPt, BasicBlocks, MBBI);
877  }
879  BasicBlocks.splice(InsertPt, BasicBlocks, MBB);
880  }
881  void splice(iterator InsertPt, iterator MBBI, iterator MBBE) {
882  BasicBlocks.splice(InsertPt, BasicBlocks, MBBI, MBBE);
883  }
884 
885  void remove(iterator MBBI) { BasicBlocks.remove(MBBI); }
886  void remove(MachineBasicBlock *MBBI) { BasicBlocks.remove(MBBI); }
887  void erase(iterator MBBI) { BasicBlocks.erase(MBBI); }
888  void erase(MachineBasicBlock *MBBI) { BasicBlocks.erase(MBBI); }
889 
890  template <typename Comp>
891  void sort(Comp comp) {
892  BasicBlocks.sort(comp);
893  }
894 
895  /// Return the number of \p MachineInstrs in this \p MachineFunction.
896  unsigned getInstructionCount() const {
897  unsigned InstrCount = 0;
898  for (const MachineBasicBlock &MBB : BasicBlocks)
899  InstrCount += MBB.size();
900  return InstrCount;
901  }
902 
903  //===--------------------------------------------------------------------===//
904  // Internal functions used to automatically number MachineBasicBlocks
905 
906  /// Adds the MBB to the internal numbering. Returns the unique number
907  /// assigned to the MBB.
909  MBBNumbering.push_back(MBB);
910  return (unsigned)MBBNumbering.size()-1;
911  }
912 
913  /// removeFromMBBNumbering - Remove the specific machine basic block from our
914  /// tracker, this is only really to be used by the MachineBasicBlock
915  /// implementation.
916  void removeFromMBBNumbering(unsigned N) {
917  assert(N < MBBNumbering.size() && "Illegal basic block #");
918  MBBNumbering[N] = nullptr;
919  }
920 
921  /// CreateMachineInstr - Allocate a new MachineInstr. Use this instead
922  /// of `new MachineInstr'.
923  MachineInstr *CreateMachineInstr(const MCInstrDesc &MCID, DebugLoc DL,
924  bool NoImplicit = false);
925 
926  /// Create a new MachineInstr which is a copy of \p Orig, identical in all
927  /// ways except the instruction has no parent, prev, or next. Bundling flags
928  /// are reset.
929  ///
930  /// Note: Clones a single instruction, not whole instruction bundles.
931  /// Does not perform target specific adjustments; consider using
932  /// TargetInstrInfo::duplicate() instead.
933  MachineInstr *CloneMachineInstr(const MachineInstr *Orig);
934 
935  /// Clones instruction or the whole instruction bundle \p Orig and insert
936  /// into \p MBB before \p InsertBefore.
937  ///
938  /// Note: Does not perform target specific adjustments; consider using
939  /// TargetInstrInfo::duplicate() intead.
940  MachineInstr &
941  cloneMachineInstrBundle(MachineBasicBlock &MBB,
942  MachineBasicBlock::iterator InsertBefore,
943  const MachineInstr &Orig);
944 
945  /// DeleteMachineInstr - Delete the given MachineInstr.
946  void deleteMachineInstr(MachineInstr *MI);
947 
948  /// CreateMachineBasicBlock - Allocate a new MachineBasicBlock. Use this
949  /// instead of `new MachineBasicBlock'.
950  MachineBasicBlock *CreateMachineBasicBlock(const BasicBlock *bb = nullptr);
951 
952  /// DeleteMachineBasicBlock - Delete the given MachineBasicBlock.
953  void deleteMachineBasicBlock(MachineBasicBlock *MBB);
954 
955  /// getMachineMemOperand - Allocate a new MachineMemOperand.
956  /// MachineMemOperands are owned by the MachineFunction and need not be
957  /// explicitly deallocated.
960  Align base_alignment, const AAMDNodes &AAInfo = AAMDNodes(),
961  const MDNode *Ranges = nullptr, SyncScope::ID SSID = SyncScope::System,
963  AtomicOrdering FailureOrdering = AtomicOrdering::NotAtomic);
964 
967  Align base_alignment, const AAMDNodes &AAInfo = AAMDNodes(),
968  const MDNode *Ranges = nullptr, SyncScope::ID SSID = SyncScope::System,
970  AtomicOrdering FailureOrdering = AtomicOrdering::NotAtomic);
971 
972  /// getMachineMemOperand - Allocate a new MachineMemOperand by copying
973  /// an existing one, adjusting by an offset and using the given size.
974  /// MachineMemOperands are owned by the MachineFunction and need not be
975  /// explicitly deallocated.
977  int64_t Offset, LLT Ty);
979  int64_t Offset, uint64_t Size) {
980  return getMachineMemOperand(
981  MMO, Offset, Size == ~UINT64_C(0) ? LLT() : LLT::scalar(8 * Size));
982  }
983 
984  /// getMachineMemOperand - Allocate a new MachineMemOperand by copying
985  /// an existing one, replacing only the MachinePointerInfo and size.
986  /// MachineMemOperands are owned by the MachineFunction and need not be
987  /// explicitly deallocated.
989  const MachinePointerInfo &PtrInfo,
990  uint64_t Size);
992  const MachinePointerInfo &PtrInfo,
993  LLT Ty);
994 
995  /// Allocate a new MachineMemOperand by copying an existing one,
996  /// replacing only AliasAnalysis information. MachineMemOperands are owned
997  /// by the MachineFunction and need not be explicitly deallocated.
999  const AAMDNodes &AAInfo);
1000 
1001  /// Allocate a new MachineMemOperand by copying an existing one,
1002  /// replacing the flags. MachineMemOperands are owned
1003  /// by the MachineFunction and need not be explicitly deallocated.
1005  MachineMemOperand::Flags Flags);
1006 
1008 
1009  /// Allocate an array of MachineOperands. This is only intended for use by
1010  /// internal MachineInstr functions.
1012  return OperandRecycler.allocate(Cap, Allocator);
1013  }
1014 
1015  /// Dellocate an array of MachineOperands and recycle the memory. This is
1016  /// only intended for use by internal MachineInstr functions.
1017  /// Cap must be the same capacity that was used to allocate the array.
1019  OperandRecycler.deallocate(Cap, Array);
1020  }
1021 
1022  /// Allocate and initialize a register mask with @p NumRegister bits.
1023  uint32_t *allocateRegMask();
1024 
1025  ArrayRef<int> allocateShuffleMask(ArrayRef<int> Mask);
1026 
1027  /// Allocate and construct an extra info structure for a `MachineInstr`.
1028  ///
1029  /// This is allocated on the function's allocator and so lives the life of
1030  /// the function.
1031  MachineInstr::ExtraInfo *createMIExtraInfo(
1032  ArrayRef<MachineMemOperand *> MMOs, MCSymbol *PreInstrSymbol = nullptr,
1033  MCSymbol *PostInstrSymbol = nullptr, MDNode *HeapAllocMarker = nullptr,
1034  MDNode *PCSections = nullptr, uint32_t CFIType = 0);
1035 
1036  /// Allocate a string and populate it with the given external symbol name.
1037  const char *createExternalSymbolName(StringRef Name);
1038 
1039  //===--------------------------------------------------------------------===//
1040  // Label Manipulation.
1041 
1042  /// getJTISymbol - Return the MCSymbol for the specified non-empty jump table.
1043  /// If isLinkerPrivate is specified, an 'l' label is returned, otherwise a
1044  /// normal 'L' label is returned.
1045  MCSymbol *getJTISymbol(unsigned JTI, MCContext &Ctx,
1046  bool isLinkerPrivate = false) const;
1047 
1048  /// getPICBaseSymbol - Return a function-local symbol to represent the PIC
1049  /// base.
1050  MCSymbol *getPICBaseSymbol() const;
1051 
1052  /// Returns a reference to a list of cfi instructions in the function's
1053  /// prologue. Used to construct frame maps for debug and exception handling
1054  /// comsumers.
1055  const std::vector<MCCFIInstruction> &getFrameInstructions() const {
1056  return FrameInstructions;
1057  }
1058 
1059  [[nodiscard]] unsigned addFrameInst(const MCCFIInstruction &Inst);
1060 
1061  /// Returns a reference to a list of symbols immediately following calls to
1062  /// _setjmp in the function. Used to construct the longjmp target table used
1063  /// by Windows Control Flow Guard.
1064  const std::vector<MCSymbol *> &getLongjmpTargets() const {
1065  return LongjmpTargets;
1066  }
1067 
1068  /// Add the specified symbol to the list of valid longjmp targets for Windows
1069  /// Control Flow Guard.
1070  void addLongjmpTarget(MCSymbol *Target) { LongjmpTargets.push_back(Target); }
1071 
1072  /// Returns a reference to a list of symbols that we have catchrets.
1073  /// Used to construct the catchret target table used by Windows EHCont Guard.
1074  const std::vector<MCSymbol *> &getCatchretTargets() const {
1075  return CatchretTargets;
1076  }
1077 
1078  /// Add the specified symbol to the list of valid catchret targets for Windows
1079  /// EHCont Guard.
1081  CatchretTargets.push_back(Target);
1082  }
1083 
1084  /// \name Exception Handling
1085  /// \{
1086 
1087  bool callsEHReturn() const { return CallsEHReturn; }
1088  void setCallsEHReturn(bool b) { CallsEHReturn = b; }
1089 
1090  bool callsUnwindInit() const { return CallsUnwindInit; }
1091  void setCallsUnwindInit(bool b) { CallsUnwindInit = b; }
1092 
1093  bool hasEHCatchret() const { return HasEHCatchret; }
1094  void setHasEHCatchret(bool V) { HasEHCatchret = V; }
1095 
1096  bool hasEHScopes() const { return HasEHScopes; }
1097  void setHasEHScopes(bool V) { HasEHScopes = V; }
1098 
1099  bool hasEHFunclets() const { return HasEHFunclets; }
1100  void setHasEHFunclets(bool V) { HasEHFunclets = V; }
1101 
1102  /// Find or create an LandingPadInfo for the specified MachineBasicBlock.
1103  LandingPadInfo &getOrCreateLandingPadInfo(MachineBasicBlock *LandingPad);
1104 
1105  /// Remap landing pad labels and remove any deleted landing pads.
1106  void tidyLandingPads(DenseMap<MCSymbol *, uintptr_t> *LPMap = nullptr,
1107  bool TidyIfNoBeginLabels = true);
1108 
1109  /// Return a reference to the landing pad info for the current function.
1110  const std::vector<LandingPadInfo> &getLandingPads() const {
1111  return LandingPads;
1112  }
1113 
1114  /// Provide the begin and end labels of an invoke style call and associate it
1115  /// with a try landing pad block.
1116  void addInvoke(MachineBasicBlock *LandingPad,
1117  MCSymbol *BeginLabel, MCSymbol *EndLabel);
1118 
1119  /// Add a new panding pad, and extract the exception handling information from
1120  /// the landingpad instruction. Returns the label ID for the landing pad
1121  /// entry.
1122  MCSymbol *addLandingPad(MachineBasicBlock *LandingPad);
1123 
1124  /// Provide the catch typeinfo for a landing pad.
1125  void addCatchTypeInfo(MachineBasicBlock *LandingPad,
1127 
1128  /// Provide the filter typeinfo for a landing pad.
1129  void addFilterTypeInfo(MachineBasicBlock *LandingPad,
1131 
1132  /// Add a cleanup action for a landing pad.
1133  void addCleanup(MachineBasicBlock *LandingPad);
1134 
1135  /// Return the type id for the specified typeinfo. This is function wide.
1136  unsigned getTypeIDFor(const GlobalValue *TI);
1137 
1138  /// Return the id of the filter encoded by TyIds. This is function wide.
1139  int getFilterIDFor(std::vector<unsigned> &TyIds);
1140 
1141  /// Map the landing pad's EH symbol to the call site indexes.
1142  void setCallSiteLandingPad(MCSymbol *Sym, ArrayRef<unsigned> Sites);
1143 
1144  /// Return if there is any wasm exception handling.
1146  return !WasmLPadToIndexMap.empty();
1147  }
1148 
1149  /// Map the landing pad to its index. Used for Wasm exception handling.
1150  void setWasmLandingPadIndex(const MachineBasicBlock *LPad, unsigned Index) {
1151  WasmLPadToIndexMap[LPad] = Index;
1152  }
1153 
1154  /// Returns true if the landing pad has an associate index in wasm EH.
1155  bool hasWasmLandingPadIndex(const MachineBasicBlock *LPad) const {
1156  return WasmLPadToIndexMap.count(LPad);
1157  }
1158 
1159  /// Get the index in wasm EH for a given landing pad.
1160  unsigned getWasmLandingPadIndex(const MachineBasicBlock *LPad) const {
1161  assert(hasWasmLandingPadIndex(LPad));
1162  return WasmLPadToIndexMap.lookup(LPad);
1163  }
1164 
1166  return !LPadToCallSiteMap.empty();
1167  }
1168 
1169  /// Get the call site indexes for a landing pad EH symbol.
1171  assert(hasCallSiteLandingPad(Sym) &&
1172  "missing call site number for landing pad!");
1173  return LPadToCallSiteMap[Sym];
1174  }
1175 
1176  /// Return true if the landing pad Eh symbol has an associated call site.
1178  return !LPadToCallSiteMap[Sym].empty();
1179  }
1180 
1181  bool hasAnyCallSiteLabel() const {
1182  return !CallSiteMap.empty();
1183  }
1184 
1185  /// Map the begin label for a call site.
1186  void setCallSiteBeginLabel(MCSymbol *BeginLabel, unsigned Site) {
1187  CallSiteMap[BeginLabel] = Site;
1188  }
1189 
1190  /// Get the call site number for a begin label.
1191  unsigned getCallSiteBeginLabel(MCSymbol *BeginLabel) const {
1192  assert(hasCallSiteBeginLabel(BeginLabel) &&
1193  "Missing call site number for EH_LABEL!");
1194  return CallSiteMap.lookup(BeginLabel);
1195  }
1196 
1197  /// Return true if the begin label has a call site number associated with it.
1198  bool hasCallSiteBeginLabel(MCSymbol *BeginLabel) const {
1199  return CallSiteMap.count(BeginLabel);
1200  }
1201 
1202  /// Record annotations associated with a particular label.
1204  CodeViewAnnotations.push_back({Label, MD});
1205  }
1206 
1208  return CodeViewAnnotations;
1209  }
1210 
1211  /// Return a reference to the C++ typeinfo for the current function.
1212  const std::vector<const GlobalValue *> &getTypeInfos() const {
1213  return TypeInfos;
1214  }
1215 
1216  /// Return a reference to the typeids encoding filters used in the current
1217  /// function.
1218  const std::vector<unsigned> &getFilterIds() const {
1219  return FilterIds;
1220  }
1221 
1222  /// \}
1223 
1224  /// Collect information used to emit debugging information of a variable.
1225  void setVariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr,
1226  int Slot, const DILocation *Loc) {
1227  VariableDbgInfos.emplace_back(Var, Expr, Slot, Loc);
1228  }
1229 
1230  VariableDbgInfoMapTy &getVariableDbgInfo() { return VariableDbgInfos; }
1232  return VariableDbgInfos;
1233  }
1234 
1235  /// Start tracking the arguments passed to the call \p CallI.
1239  bool Inserted =
1240  CallSitesInfo.try_emplace(CallI, std::move(CallInfo)).second;
1241  (void)Inserted;
1242  assert(Inserted && "Call site info not unique");
1243  }
1244 
1246  return CallSitesInfo;
1247  }
1248 
1249  /// Following functions update call site info. They should be called before
1250  /// removing, replacing or copying call instruction.
1251 
1252  /// Erase the call site info for \p MI. It is used to remove a call
1253  /// instruction from the instruction stream.
1254  void eraseCallSiteInfo(const MachineInstr *MI);
1255  /// Copy the call site info from \p Old to \ New. Its usage is when we are
1256  /// making a copy of the instruction that will be inserted at different point
1257  /// of the instruction stream.
1258  void copyCallSiteInfo(const MachineInstr *Old,
1259  const MachineInstr *New);
1260 
1261  /// Move the call site info from \p Old to \New call site info. This function
1262  /// is used when we are replacing one call instruction with another one to
1263  /// the same callee.
1264  void moveCallSiteInfo(const MachineInstr *Old,
1265  const MachineInstr *New);
1266 
1267  unsigned getNewDebugInstrNum() {
1268  return ++DebugInstrNumberingCount;
1269  }
1270 };
1271 
1272 //===--------------------------------------------------------------------===//
1273 // GraphTraits specializations for function basic block graphs (CFGs)
1274 //===--------------------------------------------------------------------===//
1275 
1276 // Provide specializations of GraphTraits to be able to treat a
1277 // machine function as a graph of machine basic blocks... these are
1278 // the same as the machine basic block iterators, except that the root
1279 // node is implicitly the first node of the function.
1280 //
1281 template <> struct GraphTraits<MachineFunction*> :
1283  static NodeRef getEntryNode(MachineFunction *F) { return &F->front(); }
1284 
1285  // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
1287 
1289  return nodes_iterator(F->begin());
1290  }
1291 
1293  return nodes_iterator(F->end());
1294  }
1295 
1296  static unsigned size (MachineFunction *F) { return F->size(); }
1297 };
1298 template <> struct GraphTraits<const MachineFunction*> :
1300  static NodeRef getEntryNode(const MachineFunction *F) { return &F->front(); }
1301 
1302  // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
1304 
1306  return nodes_iterator(F->begin());
1307  }
1308 
1310  return nodes_iterator(F->end());
1311  }
1312 
1313  static unsigned size (const MachineFunction *F) {
1314  return F->size();
1315  }
1316 };
1317 
1318 // Provide specializations of GraphTraits to be able to treat a function as a
1319 // graph of basic blocks... and to walk it in inverse order. Inverse order for
1320 // a function is considered to be when traversing the predecessor edges of a BB
1321 // instead of the successor edges.
1322 //
1323 template <> struct GraphTraits<Inverse<MachineFunction*>> :
1326  return &G.Graph->front();
1327  }
1328 };
1329 template <> struct GraphTraits<Inverse<const MachineFunction*>> :
1332  return &G.Graph->front();
1333  }
1334 };
1335 
1336 class MachineFunctionAnalysisManager;
1337 void verifyMachineFunction(MachineFunctionAnalysisManager *,
1338  const std::string &Banner,
1339  const MachineFunction &MF);
1340 
1341 } // end namespace llvm
1342 
1343 #endif // LLVM_CODEGEN_MACHINEFUNCTION_H
llvm::MachineFunction::hasWinCFI
bool hasWinCFI() const
Definition: MachineFunction.h:738
llvm::MachineFunction::DebugPHIRegallocPos::MBB
MachineBasicBlock * MBB
Block where this PHI was originally located.
Definition: MachineFunction.h:514
llvm::MachineFunction::remove
void remove(iterator MBBI)
Definition: MachineFunction.h:885
llvm::MachineFunction::hasInlineAsm
bool hasInlineAsm() const
Returns true if the function contains any inline assembly.
Definition: MachineFunction.h:729
llvm::WasmEHFuncInfo
Definition: WasmEHFuncInfo.h:32
llvm::MachineFunction::DebugPHIRegallocPos::SubReg
unsigned SubReg
Optional subreg qualifier within Reg.
Definition: MachineFunction.h:516
llvm::MachineFunctionProperties::hasProperty
bool hasProperty(Property P) const
Definition: MachineFunction.h:192
getName
static StringRef getName(Value *V)
Definition: ProvenanceAnalysisEvaluator.cpp:42
llvm::MachineFunction::resetDelegate
void resetDelegate(Delegate *delegate)
Reset the currently registered delegate - otherwise assert.
Definition: MachineFunction.h:587
llvm::MachineFunction::getInfo
const Ty * getInfo() const
Definition: MachineFunction.h:761
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:108
MachineInstr.h
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
llvm::MachineFunction::getProperties
MachineFunctionProperties & getProperties()
Definition: MachineFunction.h:748
Pass
print lazy value Lazy Value Info Printer Pass
Definition: LazyValueInfo.cpp:1979
llvm::ArrayRecycler::allocate
T * allocate(Capacity Cap, AllocatorType &Allocator)
Allocate an array of at least the requested capacity.
Definition: ArrayRecycler.h:125
llvm::GraphTraits< MachineBasicBlock * >
Definition: MachineBasicBlock.h:1188
llvm::DataLayout
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:113
llvm::MachineFunction::getVariableDbgInfo
VariableDbgInfoMapTy & getVariableDbgInfo()
Definition: MachineFunction.h:1230
print
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
Definition: ArchiveWriter.cpp:189
llvm::MachineFunction::DebugInstrOperandPair
std::pair< unsigned, unsigned > DebugInstrOperandPair
Pair of instruction number and operand number.
Definition: MachineFunction.h:473
llvm::MachineFunctionProperties::print
void print(raw_ostream &OS) const
Print the MachineFunctionProperties in human-readable form.
Definition: MachineFunction.cpp:134
AtomicOrdering.h
llvm::iplist_impl::push_back
void push_back(pointer val)
Definition: ilist.h:314
llvm::MachineRegisterInfo
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Definition: MachineRegisterInfo.h:50
llvm::MCContext
Context object for machine code objects.
Definition: MCContext.h:76
llvm::Function
Definition: Function.h:60
llvm::MachineFunctionProperties::Property
Property
Definition: MachineFunction.h:177
llvm::MachineFunction::getContext
MCContext & getContext() const
Definition: MachineFunction.h:608
llvm::MachineFunction::VariableDbgInfo::VariableDbgInfo
VariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr, int Slot, const DILocation *Loc)
Definition: MachineFunction.h:411
llvm::DenseMapBase< DenseMap< KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >, KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >::lookup
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:197
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
llvm::BitVector::set
BitVector & set()
Definition: BitVector.h:344
llvm::MachineFunction::getSubtarget
const STC & getSubtarget() const
getSubtarget - This method returns a pointer to the specified type of TargetSubtargetInfo.
Definition: MachineFunction.h:661
llvm::Target
Target - Wrapper for Target specific information.
Definition: TargetRegistry.h:145
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1181
ilist.h
llvm::MachineFunction::end
iterator end()
Definition: MachineFunction.h:855
llvm::MachineFunction::getObserver
GISelChangeObserver * getObserver() const
Definition: MachineFunction.h:605
llvm::LandingPadInfo::LandingPadLabel
MCSymbol * LandingPadLabel
Definition: MachineFunction.h:250
llvm::MachineFunction::splice
void splice(iterator InsertPt, MachineBasicBlock *MBB)
Definition: MachineFunction.h:878
llvm::LandingPadInfo::SEHHandlers
SmallVector< SEHHandler, 1 > SEHHandlers
Definition: MachineFunction.h:249
llvm::MachineFunction::exposesReturnsTwice
bool exposesReturnsTwice() const
exposesReturnsTwice - Returns true if the function calls setjmp or any other similar functions with a...
Definition: MachineFunction.h:718
viewCFG
static void viewCFG(Function &F, const BlockFrequencyInfo *BFI, const BranchProbabilityInfo *BPI, uint64_t MaxFreq, bool CFGOnly=false)
Definition: CFGPrinter.cpp:84
llvm::X86Disassembler::Reg
Reg
All possible values of the reg field in the ModR/M byte.
Definition: X86DisassemblerDecoder.h:462
Allocator.h
llvm::SyncScope::System
@ System
Synchronized with respect to all concurrently executing threads.
Definition: LLVMContext.h:57
llvm::MachineFunction::getFunctionNumber
unsigned getFunctionNumber() const
getFunctionNumber - Return a unique ID for the current function.
Definition: MachineFunction.h:631
llvm::MachineFunction::setCallsUnwindInit
void setCallsUnwindInit(bool b)
Definition: MachineFunction.h:1091
llvm::MachineFunction::back
const MachineBasicBlock & back() const
Definition: MachineFunction.h:867
MachineBasicBlock.h
llvm::MachineFunction::DebugSubstitution::Dest
DebugInstrOperandPair Dest
Replacement instruction / operand pair.
Definition: MachineFunction.h:487
llvm::ilist_callback_traits
Callbacks do nothing by default in iplist and ilist.
Definition: ilist.h:65
llvm::MachineFunction::getNumBlockIDs
unsigned getNumBlockIDs() const
getNumBlockIDs - Return the number of MBB ID's allocated.
Definition: MachineFunction.h:798
llvm::MachineFunction::ensureAlignment
void ensureAlignment(Align A)
ensureAlignment - Make sure the function is at least A bytes aligned.
Definition: MachineFunction.h:710
InstrCount
static unsigned InstrCount
Definition: DFAPacketizer.cpp:53
llvm::DILocation
Debug location.
Definition: DebugInfoMetadata.h:1557
llvm::AAMDNodes
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
Definition: Metadata.h:652
llvm::MachineFunction::push_front
void push_front(MachineBasicBlock *MBB)
Definition: MachineFunction.h:871
llvm::DenseMapIterator
Definition: DenseMap.h:57
llvm::MachineFunction::DebugSubstitution::Subreg
unsigned Subreg
Qualifier for which part of Dest is read.
Definition: MachineFunction.h:488
llvm::MachineFunction::getInstructionCount
unsigned getInstructionCount() const
Return the number of MachineInstrs in this MachineFunction.
Definition: MachineFunction.h:896
DenseMap.h
llvm::MachineFunction::getNewDebugInstrNum
unsigned getNewDebugInstrNum()
Definition: MachineFunction.h:1267
llvm::MachineMemOperand
A description of a memory reference used in the backend.
Definition: MachineMemOperand.h:127
EHPersonalities.h
llvm::MachineFunction::insert
void insert(iterator MBBI, MachineBasicBlock *MBB)
Definition: MachineFunction.h:872
llvm::MachineFunction::getPSVManager
PseudoSourceValueManager & getPSVManager() const
Definition: MachineFunction.h:616
llvm::MachineFunctionProperties::Property::IsSSA
@ IsSSA
llvm::MachineFunctionInfo::create
static Ty * create(BumpPtrAllocator &Allocator, const Ty &MFI)
Definition: MachineFunction.h:108
llvm::MachineFunctionProperties
Properties which a MachineFunction may have at a given point in time.
Definition: MachineFunction.h:127
llvm::DenseMapBase< DenseMap< KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >, KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >::count
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
llvm::MachineFunction::setDelegate
void setDelegate(Delegate *delegate)
Set the delegate.
Definition: MachineFunction.h:595
llvm::MachineFunction::callsUnwindInit
bool callsUnwindInit() const
Definition: MachineFunction.h:1090
llvm::MachineFunction::addCodeViewAnnotation
void addCodeViewAnnotation(MCSymbol *Label, MDNode *MD)
Record annotations associated with a particular label.
Definition: MachineFunction.h:1203
llvm::iplist_impl::remove
pointer remove(iterator &IT)
Definition: ilist.h:252
llvm::MachineFunction::hasCallSiteLandingPad
bool hasCallSiteLandingPad(MCSymbol *Sym)
Return true if the landing pad Eh symbol has an associated call site.
Definition: MachineFunction.h:1177
llvm::dump
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
Definition: SparseBitVector.h:877
llvm::MachineFunction::getFunction
const Function & getFunction() const
Return the LLVM function that this machine code represents.
Definition: MachineFunction.h:625
llvm::DIExpression
DWARF expression.
Definition: DebugInfoMetadata.h:2558
llvm::MachineFunction::setHasEHFunclets
void setHasEHFunclets(bool V)
Definition: MachineFunction.h:1100
llvm::MachineFunctionInfo::create
static Ty * create(BumpPtrAllocator &Allocator, MachineFunction &MF)
Factory function: default behavior is to call new using the supplied allocator.
Definition: MachineFunction.h:103
llvm::BasicBlockSection::List
@ List
llvm::BasicBlockSection::None
@ None
p
the resulting code requires compare and branches when and if * p
Definition: README.txt:396
llvm::iplist
An intrusive list with ownership and callbacks specified/controlled by ilist_traits,...
Definition: ilist.h:391
llvm::iplist_impl::splice
void splice(iterator where, iplist_impl &L2)
Definition: ilist.h:330
llvm::SEHHandler::FilterOrFinally
const Function * FilterOrFinally
Filter or finally function. Null indicates a catch-all.
Definition: MachineFunction.h:238
F
#define F(x, y, z)
Definition: MD5.cpp:55
llvm::MachineFunction::iterator
BasicBlockListType::iterator iterator
Definition: MachineFunction.h:835
llvm::iplist_impl::erase
iterator erase(iterator where)
Definition: ilist.h:268
llvm::MachineFunction::DebugSubstitution::DebugSubstitution
DebugSubstitution(const DebugInstrOperandPair &Src, const DebugInstrOperandPair &Dest, unsigned Subreg)
Definition: MachineFunction.h:490
llvm::MachineFunction::getFrameInstructions
const std::vector< MCCFIInstruction > & getFrameInstructions() const
Returns a reference to a list of cfi instructions in the function's prologue.
Definition: MachineFunction.h:1055
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:55
llvm::GraphTraits< MachineFunction * >::nodes_end
static nodes_iterator nodes_end(MachineFunction *F)
Definition: MachineFunction.h:1292
llvm::MachineFunction::setExposesReturnsTwice
void setExposesReturnsTwice(bool B)
setCallsSetJmp - Set a flag that indicates if there's a call to a "returns twice" function.
Definition: MachineFunction.h:724
GraphTraits.h
clear
static void clear(coro::Shape &Shape)
Definition: Coroutines.cpp:149
llvm::MachineFunction::setWasmLandingPadIndex
void setWasmLandingPadIndex(const MachineBasicBlock *LPad, unsigned Index)
Map the landing pad to its index. Used for Wasm exception handling.
Definition: MachineFunction.h:1150
llvm::MachineFunction::rend
reverse_iterator rend()
Definition: MachineFunction.h:860
Arg
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
Definition: AMDGPULibCalls.cpp:187
llvm::MachineFunction::ArgRegPair::ArgNo
uint16_t ArgNo
Definition: MachineFunction.h:433
llvm::verifyMachineFunction
void verifyMachineFunction(MachineFunctionAnalysisManager *, const std::string &Banner, const MachineFunction &MF)
Definition: MachineVerifier.cpp:327
llvm::CallInfo
Definition: GVNHoist.cpp:217
llvm::BitmaskEnumDetail::Mask
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
Definition: BitmaskEnum.h:80
llvm::GraphTraits< MachineFunction * >::nodes_begin
static nodes_iterator nodes_begin(MachineFunction *F)
Definition: MachineFunction.h:1288
llvm::MachineFunction::ArgRegPair
Structure used to represent pair of argument number after call lowering and register used to transfer...
Definition: MachineFunction.h:431
llvm::GraphTraits< const MachineFunction * >::nodes_end
static nodes_iterator nodes_end(const MachineFunction *F)
Definition: MachineFunction.h:1309
bb
< i1 > br i1 label label bb bb
Definition: README.txt:978
llvm::MachineFunction::front
const MachineBasicBlock & front() const
Definition: MachineFunction.h:865
llvm::MachineFunction::ArgRegPair::ArgRegPair
ArgRegPair(Register R, unsigned Arg)
Definition: MachineFunction.h:434
llvm::MachineFunction::getRegInfo
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Definition: MachineFunction.h:666
llvm::MachineFunction::setSection
void setSection(MCSection *S)
Indicates the Section this function belongs to.
Definition: MachineFunction.h:614
llvm::MachineFunctionProperties::Property::Selected
@ Selected
llvm::MachineFunction::VariableDbgInfo::Slot
int Slot
Definition: MachineFunction.h:408
llvm::LandingPadInfo::EndLabels
SmallVector< MCSymbol *, 1 > EndLabels
Definition: MachineFunction.h:248
llvm::iplist_impl::push_front
void push_front(pointer val)
Definition: ilist.h:313
llvm::DILocalVariable
Local variable.
Definition: DebugInfoMetadata.h:3058
f
Itanium Name Demangler i e convert the string _Z1fv into f()". You can also use the CRTP base ManglingParser to perform some simple analysis on the mangled name
llvm::MachineFunction::setAlignment
void setAlignment(Align A)
setAlignment - Set the alignment of the function.
Definition: MachineFunction.h:707
llvm::MachineFunction::getInfo
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
Definition: MachineFunction.h:754
llvm::MachineFunction::getFilterIds
const std::vector< unsigned > & getFilterIds() const
Return a reference to the typeids encoding filters used in the current function.
Definition: MachineFunction.h:1218
llvm::MachineFunctionProperties::verifyRequiredProperties
bool verifyRequiredProperties(const MachineFunctionProperties &V) const
Definition: MachineFunction.h:224
llvm::GraphTraits< const MachineFunction * >::size
static unsigned size(const MachineFunction *F)
Definition: MachineFunction.h:1313
llvm::MachineFunction::setObserver
void setObserver(GISelChangeObserver *O)
Definition: MachineFunction.h:603
llvm::MachineFunction::hasAnyWasmLandingPadIndex
bool hasAnyWasmLandingPadIndex() const
Return if there is any wasm exception handling.
Definition: MachineFunction.h:1145
llvm::TargetRegisterClass
Definition: TargetRegisterInfo.h:46
llvm::MachineFunctionInfo::~MachineFunctionInfo
virtual ~MachineFunctionInfo()
llvm::MachineFunction::getCallSiteLandingPad
SmallVectorImpl< unsigned > & getCallSiteLandingPad(MCSymbol *Sym)
Get the call site indexes for a landing pad EH symbol.
Definition: MachineFunction.h:1170
b
the resulting code requires compare and branches when and if the revised code is with conditional branches instead of More there is a byte word extend before each where there should be only and the condition codes are not remembered when the same two values are compared twice More LSR enhancements i8 and i32 load store addressing modes are identical int b
Definition: README.txt:418
llvm::MachineFunction::hasBBLabels
bool hasBBLabels() const
Returns true if basic block labels are to be generated for this function.
Definition: MachineFunction.h:641
llvm::MachineFunction::getProperties
const MachineFunctionProperties & getProperties() const
Get the function properties.
Definition: MachineFunction.h:747
llvm::ArrayRecycler::deallocate
void deallocate(Capacity Cap, T *Ptr)
Deallocate an array with the specified Capacity.
Definition: ArrayRecycler.h:137
llvm::LandingPadInfo::TypeIds
std::vector< int > TypeIds
Definition: MachineFunction.h:251
llvm::dwarf::Index
Index
Definition: Dwarf.h:472
llvm::MachineFunction::size
unsigned size() const
Definition: MachineFunction.h:863
llvm::MCInstrDesc
Describe properties that are true of each instruction in the target description file.
Definition: MCInstrDesc.h:197
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::MachineOperand
MachineOperand class - Representation of each machine instruction operand.
Definition: MachineOperand.h:48
getMachineMemOperand
static MachineMemOperand * getMachineMemOperand(MachineFunction &MF, FrameIndexSDNode &FI)
Definition: StatepointLowering.cpp:359
llvm::MachineFunction::rbegin
reverse_iterator rbegin()
Definition: MachineFunction.h:858
llvm::MachineFunctionProperties::set
MachineFunctionProperties & set(Property P)
Definition: MachineFunction.h:196
llvm::MachineFunction::getVariableDbgInfo
const VariableDbgInfoMapTy & getVariableDbgInfo() const
Definition: MachineFunction.h:1231
llvm::MachineFunction::hasEHCatchret
bool hasEHCatchret() const
Definition: MachineFunction.h:1093
llvm::BasicBlockSection::Labels
@ Labels
llvm::MachineModuleInfo
This class contains meta information specific to a module.
Definition: MachineModuleInfo.h:74
llvm::ilist_callback_traits< MachineBasicBlock >::transferNodesFromList
void transferNodesFromList(ilist_callback_traits &OldList, Iterator, Iterator)
Definition: MachineFunction.h:86
llvm::GraphTraits< Inverse< const MachineFunction * > >::getEntryNode
static NodeRef getEntryNode(Inverse< const MachineFunction * > G)
Definition: MachineFunction.h:1331
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
llvm::MachineFunction::addToMBBNumbering
unsigned addToMBBNumbering(MachineBasicBlock *MBB)
Adds the MBB to the internal numbering.
Definition: MachineFunction.h:908
llvm::MachineFunction::Delegate
Definition: MachineFunction.h:416
BitVector.h
llvm::MachineFunction::begin
iterator begin()
Definition: MachineFunction.h:853
llvm::SlotIndexes
SlotIndexes pass.
Definition: SlotIndexes.h:319
llvm::MachineFunction::setHasWinCFI
void setHasWinCFI(bool v)
Definition: MachineFunction.h:741
llvm::BitVector
Definition: BitVector.h:75
llvm::BasicBlockSection::All
@ All
llvm::MachineFunction::DebugPHIRegallocPos::DebugPHIRegallocPos
DebugPHIRegallocPos(MachineBasicBlock *MBB, Register Reg, unsigned SubReg)
Definition: MachineFunction.h:517
llvm::MachineFunction::getWasmEHFuncInfo
const WasmEHFuncInfo * getWasmEHFuncInfo() const
getWasmEHFuncInfo - Return information about how the current function uses Wasm exception handling.
Definition: MachineFunction.h:694
llvm::MachineFunction::sort
void sort(Comp comp)
Definition: MachineFunction.h:891
llvm::MachineFunction::removeFromMBBNumbering
void removeFromMBBNumbering(unsigned N)
removeFromMBBNumbering - Remove the specific machine basic block from our tracker,...
Definition: MachineFunction.h:916
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
llvm::MCCFIInstruction
Definition: MCDwarf.h:478
llvm::MachineFunctionProperties::reset
MachineFunctionProperties & reset(const MachineFunctionProperties &MFP)
Definition: MachineFunction.h:217
llvm::MachineBasicBlock
Definition: MachineBasicBlock.h:94
llvm::GraphTraits< MachineFunction * >::getEntryNode
static NodeRef getEntryNode(MachineFunction *F)
Definition: MachineFunction.h:1283
llvm::MachineFunction::getConstantPool
const MachineConstantPool * getConstantPool() const
Definition: MachineFunction.h:689
llvm::MachineFunction::DebugSubstitution::Src
DebugInstrOperandPair Src
Source instruction / operand pair.
Definition: MachineFunction.h:486
llvm::MachineFunction::VariableDbgInfo::Expr
const DIExpression * Expr
Definition: MachineFunction.h:406
llvm::ilist_traits
Template traits for intrusive list.
Definition: ilist.h:90
llvm::MachineFunctionProperties::Property::NoVRegs
@ NoVRegs
llvm::MachineFunctionProperties::Property::FailsVerification
@ FailsVerification
llvm::MachineFunctionProperties::set
MachineFunctionProperties & set(const MachineFunctionProperties &MFP)
Definition: MachineFunction.h:212
llvm::ISD::BlockAddress
@ BlockAddress
Definition: ISDOpcodes.h:84
llvm::MachineFunction::getMMI
MachineModuleInfo & getMMI() const
Definition: MachineFunction.h:607
G
const DataFlowGraph & G
Definition: RDFGraph.cpp:200
llvm::MachineFunction::deallocateOperandArray
void deallocateOperandArray(OperandCapacity Cap, MachineOperand *Array)
Dellocate an array of MachineOperands and recycle the memory.
Definition: MachineFunction.h:1018
llvm::MachineFunction::getSubtarget
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Definition: MachineFunction.h:656
llvm::pointer_iterator
Definition: iterator.h:344
llvm::AtomicOrdering
AtomicOrdering
Atomic ordering for LLVM's memory model.
Definition: AtomicOrdering.h:56
llvm::MachineFunction::setHasInlineAsm
void setHasInlineAsm(bool B)
Set a flag that indicates that the function contains inline assembly.
Definition: MachineFunction.h:734
llvm::MachineFunction::rend
const_reverse_iterator rend() const
Definition: MachineFunction.h:861
llvm::MachineFunction::push_back
void push_back(MachineBasicBlock *MBB)
Definition: MachineFunction.h:870
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:264
llvm::MachineFunction::setCallSiteBeginLabel
void setCallSiteBeginLabel(MCSymbol *BeginLabel, unsigned Site)
Map the begin label for a call site.
Definition: MachineFunction.h:1186
llvm::GlobalValue
Definition: GlobalValue.h:44
llvm::WinEHFuncInfo
Definition: WinEHFuncInfo.h:90
llvm::MachineFunction::addCallArgsForwardingRegs
void addCallArgsForwardingRegs(const MachineInstr *CallI, CallSiteInfoImpl &&CallInfo)
Start tracking the arguments passed to the call CallI.
Definition: MachineFunction.h:1236
llvm::LandingPadInfo::BeginLabels
SmallVector< MCSymbol *, 1 > BeginLabels
Definition: MachineFunction.h:247
llvm::MachineFunctionProperties::Property::TracksLiveness
@ TracksLiveness
Index
uint32_t Index
Definition: ELFObjHandler.cpp:82
llvm::MachineInstr
Representation of each machine instruction.
Definition: MachineInstr.h:66
llvm::MachineFunctionProperties::reset
MachineFunctionProperties & reset()
Reset all the properties.
Definition: MachineFunction.h:207
llvm::MachineFunction::callsEHReturn
bool callsEHReturn() const
Definition: MachineFunction.h:1087
uint64_t
llvm::MachineFunction::front
MachineBasicBlock & front()
Definition: MachineFunction.h:866
llvm::MachineFunction::setHasEHCatchret
void setHasEHCatchret(bool V)
Definition: MachineFunction.h:1094
const
aarch64 promote const
Definition: AArch64PromoteConstant.cpp:232
LLVM_EXTERNAL_VISIBILITY
#define LLVM_EXTERNAL_VISIBILITY
Definition: Compiler.h:127
llvm::BasicBlockSection::Preset
@ Preset
llvm::MachineFunction::back
MachineBasicBlock & back()
Definition: MachineFunction.h:868
s
multiplies can be turned into SHL s
Definition: README.txt:370
llvm::MachineFunction::splice
void splice(iterator InsertPt, iterator MBBI)
Definition: MachineFunction.h:875
llvm::BumpPtrAllocatorImpl
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:63
llvm::MachinePointerInfo
This class contains a discriminated union of information about pointers in memory operands,...
Definition: MachineMemOperand.h:39
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::DenseMap
Definition: DenseMap.h:714
llvm::SyncScope::ID
uint8_t ID
Definition: LLVMContext.h:46
llvm::MachineConstantPool
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
Definition: MachineConstantPool.h:117
llvm::MachineFunction::hasAnyCallSiteLabel
bool hasAnyCallSiteLabel() const
Definition: MachineFunction.h:1181
iterator.h
llvm::MachineFunctionProperties::Property::TracksDebugUserValues
@ TracksDebugUserValues
llvm::MachineFunction::getCallSitesInfo
const CallSiteInfoMap & getCallSitesInfo() const
Definition: MachineFunction.h:1245
llvm::GraphTraits< const MachineFunction * >::getEntryNode
static NodeRef getEntryNode(const MachineFunction *F)
Definition: MachineFunction.h:1300
llvm::DenormalMode
Represent subnormal handling kind for floating point instruction inputs and outputs.
Definition: FloatingPointMode.h:69
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:439
llvm::GraphTraits< const MachineBasicBlock * >
Definition: MachineBasicBlock.h:1197
llvm::ilist_alloc_traits
Use delete by default for iplist and ilist.
Definition: ilist.h:41
ArrayRef.h
llvm::MachineFunctionProperties::Property::RegBankSelected
@ RegBankSelected
llvm::MachineMemOperand::Flags
Flags
Flags values. These may be or'd together.
Definition: MachineMemOperand.h:130
llvm::MachineFunction::getConstantPool
MachineConstantPool * getConstantPool()
getConstantPool - Return the constant pool object for the current function.
Definition: MachineFunction.h:688
llvm::SmallVectorImpl::const_iterator
typename SuperClass::const_iterator const_iterator
Definition: SmallVector.h:564
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::LandingPadInfo::LandingPadBlock
MachineBasicBlock * LandingPadBlock
Definition: MachineFunction.h:246
llvm::MachineFunction::getCodeViewAnnotations
ArrayRef< std::pair< MCSymbol *, MDNode * > > getCodeViewAnnotations() const
Definition: MachineFunction.h:1207
llvm::MachineFunction::getFrameInfo
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
Definition: MachineFunction.h:672
llvm::MachineFunction::getLandingPads
const std::vector< LandingPadInfo > & getLandingPads() const
Return a reference to the landing pad info for the current function.
Definition: MachineFunction.h:1110
llvm::MachineFunction::erase
void erase(iterator MBBI)
Definition: MachineFunction.h:887
llvm::ISD::BasicBlock
@ BasicBlock
Various leaf nodes.
Definition: ISDOpcodes.h:71
llvm::Recycler
Recycler - This class manages a linked-list of deallocated nodes and facilitates reusing deallocated ...
Definition: Recycler.h:34
llvm::MachineFunction::DebugSubstitution::operator<
bool operator<(const DebugSubstitution &Other) const
Order only by source instruction / operand pair: there should never be duplicate entries for the same...
Definition: MachineFunction.h:496
llvm::MDNode
Metadata node.
Definition: Metadata.h:944
llvm::DenseMapBase< DenseMap< KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >, KeyT, ValueT, DenseMapInfo< KeyT >, llvm::detail::DenseMapPair< KeyT, ValueT > >::empty
bool empty() const
Definition: DenseMap.h:98
llvm::MachineFunction::begin
const_iterator begin() const
Definition: MachineFunction.h:854
addLiveIn
static unsigned addLiveIn(MachineFunction &MF, unsigned PReg, const TargetRegisterClass *RC)
Definition: MipsISelLowering.cpp:1253
llvm::MachineFunction
Definition: MachineFunction.h:257
llvm::MachineFunction::getWasmEHFuncInfo
WasmEHFuncInfo * getWasmEHFuncInfo()
Definition: MachineFunction.h:695
TargetOptions.h
ConstantPool
MIPS Relocation Principles In there are several elements of the llvm::ISD::NodeType enum that deal with addresses and or relocations These are defined in include llvm Target TargetSelectionDAG td ConstantPool
Definition: Relocation.txt:6
llvm::BlockAddress
The address of a basic block.
Definition: Constants.h:849
llvm::MachineFunction::OperandCapacity
ArrayRecycler< MachineOperand >::Capacity OperandCapacity
Definition: MachineFunction.h:1007
llvm::GraphTraits< const MachineFunction * >::nodes_begin
static nodes_iterator nodes_begin(const MachineFunction *F)
Definition: MachineFunction.h:1305
llvm::MachineFunction::rbegin
const_reverse_iterator rbegin() const
Definition: MachineFunction.h:859
llvm::ArrayRef< int >
RegInfo
Definition: AMDGPUAsmParser.cpp:2581
llvm::MachineFunction::splice
void splice(iterator InsertPt, iterator MBBI, iterator MBBE)
Definition: MachineFunction.h:881
llvm::MachineFunction::setHasEHScopes
void setHasEHScopes(bool V)
Definition: MachineFunction.h:1097
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
llvm::MachineFunction::VariableDbgInfo::Loc
const DILocation * Loc
Definition: MachineFunction.h:409
MBBI
MachineBasicBlock MachineBasicBlock::iterator MBBI
Definition: AArch64SLSHardening.cpp:75
llvm::ilist_callback_traits::addNodeToList
void addNodeToList(NodeTy *)
When an MBB is added to an MF, we need to update the parent pointer of the MBB, the MBB numbering,...
Definition: ilist.h:66
uint32_t
Compiler.h
llvm::MachineFunction::DebugPHIRegallocPos
Location of a PHI instruction that is also a debug-info variable value, for the duration of register ...
Definition: MachineFunction.h:512
llvm::MachineFunction::DebugPHIRegallocPos::Reg
Register Reg
VReg where the control-flow-merge happens.
Definition: MachineFunction.h:515
llvm::GraphTraits< MachineFunction * >::size
static unsigned size(MachineFunction *F)
Definition: MachineFunction.h:1296
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::MCSection
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition: MCSection.h:39
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::MachineFunction::hasBBSections
bool hasBBSections() const
Returns true if this function has basic block sections enabled.
Definition: MachineFunction.h:634
llvm::MachineFunctionProperties::Property::TiedOpsRewritten
@ TiedOpsRewritten
llvm::MachineFunctionProperties::reset
MachineFunctionProperties & reset(Property P)
Definition: MachineFunction.h:201
llvm::GISelChangeObserver
Abstract class that contains various methods for clients to notify about changes.
Definition: GISelChangeObserver.h:29
llvm::EHPersonality
EHPersonality
Definition: EHPersonalities.h:21
llvm::TargetSubtargetInfo
TargetSubtargetInfo - Generic base class for all target subtargets.
Definition: TargetSubtargetInfo.h:60
llvm::MachineFunction::hasAnyCallSiteLandingPad
bool hasAnyCallSiteLandingPad() const
Definition: MachineFunction.h:1165
llvm::Register
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
llvm::GraphTraits< Inverse< MachineFunction * > >::getEntryNode
static NodeRef getEntryNode(Inverse< MachineFunction * > G)
Definition: MachineFunction.h:1325
llvm::ArrayRecycler< MachineOperand >
llvm::MachineFunction::DebugSubstitution
Replacement definition for a debug instruction reference.
Definition: MachineFunction.h:484
llvm::MachineFunction::getSection
MCSection * getSection() const
Returns the Section this function belongs to.
Definition: MachineFunction.h:611
llvm::MachineFunction::cloneInfo
Ty * cloneInfo(const Ty &Old)
Definition: MachineFunction.h:765
llvm::EHPersonality::Unknown
@ Unknown
MBB
MachineBasicBlock & MBB
Definition: AArch64SLSHardening.cpp:74
llvm::MachineFunction::end
const_iterator end() const
Definition: MachineFunction.h:856
llvm::MachineFunction::getFrameInfo
const MachineFrameInfo & getFrameInfo() const
Definition: MachineFunction.h:673
llvm::MachineFunctionProperties::Property::FailedISel
@ FailedISel
llvm::MachineFunction::getBlockNumbered
MachineBasicBlock * getBlockNumbered(unsigned N) const
getBlockNumbered - MachineBasicBlocks are automatically numbered when they are inserted into the mach...
Definition: MachineFunction.h:788
llvm::BitVector::test
bool test(unsigned Idx) const
Definition: BitVector.h:454
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:50
llvm::MachineFunction::getFunction
Function & getFunction()
Return the LLVM function that this machine code represents.
Definition: MachineFunction.h:622
llvm::MachineFunctionProperties::Property::NoPHIs
@ NoPHIs
uint16_t
llvm::MachineFunction::getTarget
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
Definition: MachineFunction.h:652
llvm::ilist_iterator
Iterator for intrusive lists based on ilist_node.
Definition: ilist_iterator.h:57
llvm::MachineFunction::erase
void erase(MachineBasicBlock *MBBI)
Definition: MachineFunction.h:888
llvm::MachineFunction::getWinEHFuncInfo
const WinEHFuncInfo * getWinEHFuncInfo() const
getWinEHFuncInfo - Return information about how the current function uses Windows exception handling.
Definition: MachineFunction.h:700
llvm::MachineFunction::addCatchretTarget
void addCatchretTarget(MCSymbol *Target)
Add the specified symbol to the list of valid catchret targets for Windows EHCont Guard.
Definition: MachineFunction.h:1080
llvm::fltSemantics
Definition: APFloat.cpp:54
llvm::MachineFunction::allocateOperandArray
MachineOperand * allocateOperandArray(OperandCapacity Cap)
Allocate an array of MachineOperands.
Definition: MachineFunction.h:1011
llvm::MachineFunction::hasCallSiteBeginLabel
bool hasCallSiteBeginLabel(MCSymbol *BeginLabel) const
Return true if the begin label has a call site number associated with it.
Definition: MachineFunction.h:1198
llvm::ilist_callback_traits::removeNodeFromList
void removeNodeFromList(NodeTy *)
Definition: ilist.h:67
verify
ppc ctr loops verify
Definition: PPCCTRLoopsVerify.cpp:76
llvm::MachineFunction::getWinEHFuncInfo
WinEHFuncInfo * getWinEHFuncInfo()
Definition: MachineFunction.h:701
llvm::LLVMTargetMachine
This class describes a target machine that is implemented with the LLVM target-independent code gener...
Definition: TargetMachine.h:414
llvm::MachineInstr::isCandidateForCallSiteEntry
bool isCandidateForCallSiteEntry(QueryType Type=IgnoreBundle) const
Return true if this is a call instruction that may have an associated call site entry in the debug in...
Definition: MachineInstr.cpp:694
llvm::Inverse
Definition: GraphTraits.h:97
llvm::MachineFunction::hasEHFunclets
bool hasEHFunclets() const
Definition: MachineFunction.h:1099
llvm::BitVector::reset
BitVector & reset()
Definition: BitVector.h:385
llvm::MachineFunction::addLongjmpTarget
void addLongjmpTarget(MCSymbol *Target)
Add the specified symbol to the list of valid longjmp targets for Windows Control Flow Guard.
Definition: MachineFunction.h:1070
llvm::iplist_impl::insert
iterator insert(iterator where, pointer New)
Definition: ilist.h:229
llvm::MachineFunction::ArgRegPair::Reg
Register Reg
Definition: MachineFunction.h:432
llvm::SEHHandler
Definition: MachineFunction.h:236
llvm::MachineFrameInfo
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
Definition: MachineFrameInfo.h:105
llvm::Pass
Pass interface - Implemented by all 'passes'.
Definition: Pass.h:91
llvm::BasicBlockSection
BasicBlockSection
Definition: TargetOptions.h:61
SmallVector.h
llvm::MachineFunction::hasWasmLandingPadIndex
bool hasWasmLandingPadIndex(const MachineBasicBlock *LPad) const
Returns true if the landing pad has an associate index in wasm EH.
Definition: MachineFunction.h:1155
llvm::MachineFunction::reset
void reset()
Reset the instance as if it was just created.
Definition: MachineFunction.h:581
llvm::PseudoSourceValueManager
Manages creation of pseudo source values.
Definition: PseudoSourceValue.h:155
ArrayRecycler.h
llvm::ilist_alloc_traits::deleteNode
static void deleteNode(NodeTy *V)
Definition: ilist.h:42
Allocator
Basic Register Allocator
Definition: RegAllocBasic.cpp:143
llvm::MachineFunctionProperties::Property::LastProperty
@ LastProperty
llvm::SmallVectorImpl::iterator
typename SuperClass::iterator iterator
Definition: SmallVector.h:563
N
#define N
llvm::MachineFunction::DebugValueSubstitutions
SmallVector< DebugSubstitution, 8 > DebugValueSubstitutions
Debug value substitutions: a collection of DebugSubstitution objects, recording changes in where a va...
Definition: MachineFunction.h:505
llvm::DenseMapBase::try_emplace
std::pair< iterator, bool > try_emplace(KeyT &&Key, Ts &&... Args)
Definition: DenseMap.h:222
MachineMemOperand.h
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:42
llvm::MachineFunction::getCallSiteBeginLabel
unsigned getCallSiteBeginLabel(MCSymbol *BeginLabel) const
Get the call site number for a begin label.
Definition: MachineFunction.h:1191
llvm::LandingPadInfo
This structure is used to retain landing pad info for the current function.
Definition: MachineFunction.h:245
llvm::MachineFunction::getSublistAccess
static BasicBlockListType MachineFunction::* getSublistAccess(MachineBasicBlock *)
Support for MachineBasicBlock::getNextNode().
Definition: MachineFunction.h:842
llvm::MachineFunction::remove
void remove(MachineBasicBlock *MBBI)
Definition: MachineFunction.h:886
llvm::MachineFunction::cloneInfoFrom
MachineFunctionInfo * cloneInfoFrom(const MachineFunction &OrigMF, const DenseMap< MachineBasicBlock *, MachineBasicBlock * > &Src2DstMBB)
Definition: MachineFunction.h:771
llvm::MachineFunction::VariableDbgInfo::Var
const DILocalVariable * Var
Definition: MachineFunction.h:405
llvm::MachineFunction::DebugPHIPositions
DenseMap< unsigned, DebugPHIRegallocPos > DebugPHIPositions
Map of debug instruction numbers to the position of their PHI instructions during register allocation...
Definition: MachineFunction.h:523
llvm::MachineFunction::getTypeInfos
const std::vector< const GlobalValue * > & getTypeInfos() const
Return a reference to the C++ typeinfo for the current function.
Definition: MachineFunction.h:1212
llvm::MachineFunction::getCatchretTargets
const std::vector< MCSymbol * > & getCatchretTargets() const
Returns a reference to a list of symbols that we have catchrets.
Definition: MachineFunction.h:1074
llvm::MachineFunction::getWasmLandingPadIndex
unsigned getWasmLandingPadIndex(const MachineBasicBlock *LPad) const
Get the index in wasm EH for a given landing pad.
Definition: MachineFunction.h:1160
llvm::MachineFunction::getJumpTableInfo
const MachineJumpTableInfo * getJumpTableInfo() const
getJumpTableInfo - Return the jump table info object for the current function.
Definition: MachineFunction.h:679
llvm::GraphTraits
Definition: GraphTraits.h:37
llvm::MachineFunction::DebugOperandMemNumber
const static unsigned int DebugOperandMemNumber
A reserved operand number representing the instructions memory operand, for instructions that have a ...
Definition: MachineFunction.h:571
llvm::DebugLoc
A debug info location.
Definition: DebugLoc.h:33
Recycler.h
llvm::MachineFunction::hasEHScopes
bool hasEHScopes() const
Definition: MachineFunction.h:1096
llvm::MachineJumpTableInfo
Definition: MachineJumpTableInfo.h:42
llvm::MachineFunction::VariableDbgInfo
Definition: MachineFunction.h:404
llvm::MachineFunction::empty
bool empty() const
Definition: MachineFunction.h:864
llvm::MachineFunction::getJumpTableInfo
MachineJumpTableInfo * getJumpTableInfo()
Definition: MachineFunction.h:680
llvm::MachineFunction::VariableDbgInfos
VariableDbgInfoMapTy VariableDbgInfos
Definition: MachineFunction.h:461
llvm::MachineInstrBundleIterator< MachineInstr >
llvm::LLT::scalar
static LLT scalar(unsigned SizeInBits)
Get a low-level scalar or aggregate "bag of bits".
Definition: LowLevelTypeImpl.h:42
llvm::MachineFunction::getMachineMemOperand
MachineMemOperand * getMachineMemOperand(const MachineMemOperand *MMO, int64_t Offset, uint64_t Size)
Definition: MachineFunction.h:978
llvm::MachineFunction::getAlignment
Align getAlignment() const
getAlignment - Return the alignment of the function.
Definition: MachineFunction.h:704
llvm::MachineFunction::setBBSectionsType
void setBBSectionsType(BasicBlockSection V)
Definition: MachineFunction.h:645
llvm::MachineFunctionInfo
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
Definition: MachineFunction.h:95
llvm::SEHHandler::RecoverBA
const BlockAddress * RecoverBA
Address of block to recover at. Null for a finally handler.
Definition: MachineFunction.h:241
llvm::MachineFunction::setVariableDbgInfo
void setVariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr, int Slot, const DILocation *Loc)
Collect information used to emit debugging information of a variable.
Definition: MachineFunction.h:1225
llvm::LandingPadInfo::LandingPadInfo
LandingPadInfo(MachineBasicBlock *MBB)
Definition: MachineFunction.h:253
SubReg
unsigned SubReg
Definition: AArch64AdvSIMDScalarPass.cpp:104
llvm::MachineFunction::setCallsEHReturn
void setCallsEHReturn(bool b)
Definition: MachineFunction.h:1088
llvm::AtomicOrdering::NotAtomic
@ NotAtomic
llvm::codeview::PublicSymFlags::Function
@ Function
llvm::ISD::MCSymbol
@ MCSymbol
Definition: ISDOpcodes.h:172
llvm::MachineFunction::getRegInfo
const MachineRegisterInfo & getRegInfo() const
Definition: MachineFunction.h:667
Other
Optional< std::vector< StOtherPiece > > Other
Definition: ELFYAML.cpp:1247
llvm::MachineFunctionInfo::clone
virtual MachineFunctionInfo * clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF, const DenseMap< MachineBasicBlock *, MachineBasicBlock * > &Src2DstMBB) const
Make a functionally equivalent copy of this MachineFunctionInfo in MF.
Definition: MachineFunction.h:117
llvm::MachineFunction::getLongjmpTargets
const std::vector< MCSymbol * > & getLongjmpTargets() const
Returns a reference to a list of symbols immediately following calls to _setjmp in the function.
Definition: MachineFunction.h:1064
llvm::SmallVectorImpl::emplace_back
reference emplace_back(ArgTypes &&... Args)
Definition: SmallVector.h:923
llvm::MCRegister
Wrapper class representing physical registers. Should be passed by value.
Definition: MCRegister.h:24
llvm::MachineFunctionProperties::Property::Legalized
@ Legalized
llvm::LLT
Definition: LowLevelTypeImpl.h:39