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