LLVM  13.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  enum class Property : unsigned {
153  IsSSA,
154  NoPHIs,
156  NoVRegs,
157  FailedISel,
158  Legalized,
160  Selected,
163  };
164 
165  bool hasProperty(Property P) const {
166  return Properties[static_cast<unsigned>(P)];
167  }
168 
170  Properties.set(static_cast<unsigned>(P));
171  return *this;
172  }
173 
175  Properties.reset(static_cast<unsigned>(P));
176  return *this;
177  }
178 
179  /// Reset all the properties.
181  Properties.reset();
182  return *this;
183  }
184 
186  Properties |= MFP.Properties;
187  return *this;
188  }
189 
191  Properties.reset(MFP.Properties);
192  return *this;
193  }
194 
195  // Returns true if all properties set in V (i.e. required by a pass) are set
196  // in this.
198  return !V.Properties.test(Properties);
199  }
200 
201  /// Print the MachineFunctionProperties in human-readable form.
202  void print(raw_ostream &OS) const;
203 
204 private:
205  BitVector Properties =
206  BitVector(static_cast<unsigned>(Property::LastProperty)+1);
207 };
208 
209 struct SEHHandler {
210  /// Filter or finally function. Null indicates a catch-all.
212 
213  /// Address of block to recover at. Null for a finally handler.
215 };
216 
217 /// This structure is used to retain landing pad info for the current function.
219  MachineBasicBlock *LandingPadBlock; // Landing pad block.
220  SmallVector<MCSymbol *, 1> BeginLabels; // Labels prior to invoke.
221  SmallVector<MCSymbol *, 1> EndLabels; // Labels after invoke.
222  SmallVector<SEHHandler, 1> SEHHandlers; // SEH handlers active at this lpad.
223  MCSymbol *LandingPadLabel = nullptr; // Label at beginning of landing pad.
224  std::vector<int> TypeIds; // List of type ids (filters negative).
225 
227  : LandingPadBlock(MBB) {}
228 };
229 
231  Function &F;
232  const LLVMTargetMachine &Target;
233  const TargetSubtargetInfo *STI;
234  MCContext &Ctx;
235  MachineModuleInfo &MMI;
236 
237  // RegInfo - Information about each register in use in the function.
239 
240  // Used to keep track of target-specific per-machine function information for
241  // the target implementation.
242  MachineFunctionInfo *MFInfo;
243 
244  // Keep track of objects allocated on the stack.
245  MachineFrameInfo *FrameInfo;
246 
247  // Keep track of constants which are spilled to memory
249 
250  // Keep track of jump tables for switch instructions
251  MachineJumpTableInfo *JumpTableInfo;
252 
253  // Keep track of the function section.
254  MCSection *Section = nullptr;
255 
256  // Keeps track of Wasm exception handling related data. This will be null for
257  // functions that aren't using a wasm EH personality.
258  WasmEHFuncInfo *WasmEHInfo = nullptr;
259 
260  // Keeps track of Windows exception handling related data. This will be null
261  // for functions that aren't using a funclet-based EH personality.
262  WinEHFuncInfo *WinEHInfo = nullptr;
263 
264  // Function-level unique numbering for MachineBasicBlocks. When a
265  // MachineBasicBlock is inserted into a MachineFunction is it automatically
266  // numbered and this vector keeps track of the mapping from ID's to MBB's.
267  std::vector<MachineBasicBlock*> MBBNumbering;
268 
269  // Unary encoding of basic block symbols is used to reduce size of ".strtab".
270  // Basic block number 'i' gets a prefix of length 'i'. The ith character also
271  // denotes the type of basic block number 'i'. Return blocks are marked with
272  // 'r', landing pads with 'l' and regular blocks with 'a'.
273  std::vector<char> BBSectionsSymbolPrefix;
274 
275  // Pool-allocate MachineFunction-lifetime and IR objects.
276  BumpPtrAllocator Allocator;
277 
278  // Allocation management for instructions in function.
279  Recycler<MachineInstr> InstructionRecycler;
280 
281  // Allocation management for operand arrays on instructions.
282  ArrayRecycler<MachineOperand> OperandRecycler;
283 
284  // Allocation management for basic blocks in function.
285  Recycler<MachineBasicBlock> BasicBlockRecycler;
286 
287  // List of machine basic blocks in function
289  BasicBlockListType BasicBlocks;
290 
291  /// FunctionNumber - This provides a unique ID for each function emitted in
292  /// this translation unit.
293  ///
294  unsigned FunctionNumber;
295 
296  /// Alignment - The alignment of the function.
297  Align Alignment;
298 
299  /// ExposesReturnsTwice - True if the function calls setjmp or related
300  /// functions with attribute "returns twice", but doesn't have
301  /// the attribute itself.
302  /// This is used to limit optimizations which cannot reason
303  /// about the control flow of such functions.
304  bool ExposesReturnsTwice = false;
305 
306  /// True if the function includes any inline assembly.
307  bool HasInlineAsm = false;
308 
309  /// True if any WinCFI instruction have been emitted in this function.
310  bool HasWinCFI = false;
311 
312  /// Current high-level properties of the IR of the function (e.g. is in SSA
313  /// form or whether registers have been allocated)
314  MachineFunctionProperties Properties;
315 
316  // Allocation management for pseudo source values.
317  std::unique_ptr<PseudoSourceValueManager> PSVManager;
318 
319  /// List of moves done by a function's prolog. Used to construct frame maps
320  /// by debug and exception handling consumers.
321  std::vector<MCCFIInstruction> FrameInstructions;
322 
323  /// List of basic blocks immediately following calls to _setjmp. Used to
324  /// construct a table of valid longjmp targets for Windows Control Flow Guard.
325  std::vector<MCSymbol *> LongjmpTargets;
326 
327  /// List of basic blocks that are the target of catchrets. Used to construct
328  /// a table of valid targets for Windows EHCont Guard.
329  std::vector<MCSymbol *> CatchretTargets;
330 
331  /// \name Exception Handling
332  /// \{
333 
334  /// List of LandingPadInfo describing the landing pad information.
335  std::vector<LandingPadInfo> LandingPads;
336 
337  /// Map a landing pad's EH symbol to the call site indexes.
339 
340  /// Map a landing pad to its index.
342 
343  /// Map of invoke call site index values to associated begin EH_LABEL.
344  DenseMap<MCSymbol*, unsigned> CallSiteMap;
345 
346  /// CodeView label annotations.
347  std::vector<std::pair<MCSymbol *, MDNode *>> CodeViewAnnotations;
348 
349  bool CallsEHReturn = false;
350  bool CallsUnwindInit = false;
351  bool HasEHCatchret = false;
352  bool HasEHScopes = false;
353  bool HasEHFunclets = false;
354 
355  /// Section Type for basic blocks, only relevant with basic block sections.
357 
358  /// List of C++ TypeInfo used.
359  std::vector<const GlobalValue *> TypeInfos;
360 
361  /// List of typeids encoding filters used.
362  std::vector<unsigned> FilterIds;
363 
364  /// List of the indices in FilterIds corresponding to filter terminators.
365  std::vector<unsigned> FilterEnds;
366 
367  EHPersonality PersonalityTypeCache = EHPersonality::Unknown;
368 
369  /// \}
370 
371  /// Clear all the members of this MachineFunction, but the ones used
372  /// to initialize again the MachineFunction.
373  /// More specifically, this deallocates all the dynamically allocated
374  /// objects and get rid of all the XXXInfo data structure, but keep
375  /// unchanged the references to Fn, Target, MMI, and FunctionNumber.
376  void clear();
377  /// Allocate and initialize the different members.
378  /// In particular, the XXXInfo data structure.
379  /// \pre Fn, Target, MMI, and FunctionNumber are properly set.
380  void init();
381 
382 public:
386  // The Slot can be negative for fixed stack objects.
387  int Slot;
388  const DILocation *Loc;
389 
391  int Slot, const DILocation *Loc)
392  : Var(Var), Expr(Expr), Slot(Slot), Loc(Loc) {}
393  };
394 
395  class Delegate {
396  virtual void anchor();
397 
398  public:
399  virtual ~Delegate() = default;
400  /// Callback after an insertion. This should not modify the MI directly.
401  virtual void MF_HandleInsertion(MachineInstr &MI) = 0;
402  /// Callback before a removal. This should not modify the MI directly.
403  virtual void MF_HandleRemoval(MachineInstr &MI) = 0;
404  };
405 
406  /// Structure used to represent pair of argument number after call lowering
407  /// and register used to transfer that argument.
408  /// For now we support only cases when argument is transferred through one
409  /// register.
410  struct ArgRegPair {
413  ArgRegPair(Register R, unsigned Arg) : Reg(R), ArgNo(Arg) {
414  assert(Arg < (1 << 16) && "Arg out of range");
415  }
416  };
417  /// Vector of call argument and its forwarding register.
420 
421 private:
422  Delegate *TheDelegate = nullptr;
423  GISelChangeObserver *Observer = nullptr;
424 
426  /// Map a call instruction to call site arguments forwarding info.
427  CallSiteInfoMap CallSitesInfo;
428 
429  /// A helper function that returns call site info for a give call
430  /// instruction if debug entry value support is enabled.
431  CallSiteInfoMap::iterator getCallSiteInfo(const MachineInstr *MI);
432 
433  // Callbacks for insertion and removal.
434  void handleInsertion(MachineInstr &MI);
435  void handleRemoval(MachineInstr &MI);
436  friend struct ilist_traits<MachineInstr>;
437 
438 public:
441 
442  /// A count of how many instructions in the function have had numbers
443  /// assigned to them. Used for debug value tracking, to determine the
444  /// next instruction number.
446 
447  /// Set value of DebugInstrNumberingCount field. Avoid using this unless
448  /// you're deserializing this data.
449  void setDebugInstrNumberingCount(unsigned Num);
450 
451  /// Pair of instruction number and operand number.
452  using DebugInstrOperandPair = std::pair<unsigned, unsigned>;
453 
454  /// Substitution map: from one <inst,operand> pair to another. Used to
455  /// record changes in where a value is defined, so that debug variable
456  /// locations can find it later.
457  std::map<DebugInstrOperandPair, DebugInstrOperandPair>
459 
460  /// Create a substitution between one <instr,operand> value to a different,
461  /// new value.
463 
464  /// Create substitutions for any tracked values in \p Old, to point at
465  /// \p New. Needed when we re-create an instruction during optimization,
466  /// which has the same signature (i.e., def operands in the same place) but
467  /// a modified instruction type, flags, or otherwise. An example: X86 moves
468  /// are sometimes transformed into equivalent LEAs.
469  /// If the two instructions are not the same opcode, limit which operands to
470  /// examine for substitutions to the first N operands by setting
471  /// \p MaxOperand.
473  unsigned MaxOperand = UINT_MAX);
474 
476  const TargetSubtargetInfo &STI, unsigned FunctionNum,
477  MachineModuleInfo &MMI);
478  MachineFunction(const MachineFunction &) = delete;
479  MachineFunction &operator=(const MachineFunction &) = delete;
481 
482  /// Reset the instance as if it was just created.
483  void reset() {
484  clear();
485  init();
486  }
487 
488  /// Reset the currently registered delegate - otherwise assert.
489  void resetDelegate(Delegate *delegate) {
490  assert(TheDelegate == delegate &&
491  "Only the current delegate can perform reset!");
492  TheDelegate = nullptr;
493  }
494 
495  /// Set the delegate. resetDelegate must be called before attempting
496  /// to set.
497  void setDelegate(Delegate *delegate) {
498  assert(delegate && !TheDelegate &&
499  "Attempted to set delegate to null, or to change it without "
500  "first resetting it!");
501 
502  TheDelegate = delegate;
503  }
504 
505  void setObserver(GISelChangeObserver *O) { Observer = O; }
506 
507  GISelChangeObserver *getObserver() const { return Observer; }
508 
509  MachineModuleInfo &getMMI() const { return MMI; }
510  MCContext &getContext() const { return Ctx; }
511 
512  /// Returns the Section this function belongs to.
513  MCSection *getSection() const { return Section; }
514 
515  /// Indicates the Section this function belongs to.
517 
518  PseudoSourceValueManager &getPSVManager() const { return *PSVManager; }
519 
520  /// Return the DataLayout attached to the Module associated to this MF.
521  const DataLayout &getDataLayout() const;
522 
523  /// Return the LLVM function that this machine code represents
524  Function &getFunction() { return F; }
525 
526  /// Return the LLVM function that this machine code represents
527  const Function &getFunction() const { return F; }
528 
529  /// getName - Return the name of the corresponding LLVM function.
530  StringRef getName() const;
531 
532  /// getFunctionNumber - Return a unique ID for the current function.
533  unsigned getFunctionNumber() const { return FunctionNumber; }
534 
535  /// Returns true if this function has basic block sections enabled.
536  bool hasBBSections() const {
537  return (BBSectionsType == BasicBlockSection::All ||
538  BBSectionsType == BasicBlockSection::List ||
539  BBSectionsType == BasicBlockSection::Preset);
540  }
541 
542  /// Returns true if basic block labels are to be generated for this function.
543  bool hasBBLabels() const {
544  return BBSectionsType == BasicBlockSection::Labels;
545  }
546 
547  void setBBSectionsType(BasicBlockSection V) { BBSectionsType = V; }
548 
549  /// Assign IsBeginSection IsEndSection fields for basic blocks in this
550  /// function.
551  void assignBeginEndSections();
552 
553  /// getTarget - Return the target machine this machine code is compiled with
554  const LLVMTargetMachine &getTarget() const { return Target; }
555 
556  /// getSubtarget - Return the subtarget for which this machine code is being
557  /// compiled.
558  const TargetSubtargetInfo &getSubtarget() const { return *STI; }
559 
560  /// getSubtarget - This method returns a pointer to the specified type of
561  /// TargetSubtargetInfo. In debug builds, it verifies that the object being
562  /// returned is of the correct type.
563  template<typename STC> const STC &getSubtarget() const {
564  return *static_cast<const STC *>(STI);
565  }
566 
567  /// getRegInfo - Return information about the registers currently in use.
569  const MachineRegisterInfo &getRegInfo() const { return *RegInfo; }
570 
571  /// getFrameInfo - Return the frame info object for the current function.
572  /// This object contains information about objects allocated on the stack
573  /// frame of the current function in an abstract way.
574  MachineFrameInfo &getFrameInfo() { return *FrameInfo; }
575  const MachineFrameInfo &getFrameInfo() const { return *FrameInfo; }
576 
577  /// getJumpTableInfo - Return the jump table info object for the current
578  /// function. This object contains information about jump tables in the
579  /// current function. If the current function has no jump tables, this will
580  /// return null.
581  const MachineJumpTableInfo *getJumpTableInfo() const { return JumpTableInfo; }
582  MachineJumpTableInfo *getJumpTableInfo() { return JumpTableInfo; }
583 
584  /// getOrCreateJumpTableInfo - Get the JumpTableInfo for this function, if it
585  /// does already exist, allocate one.
586  MachineJumpTableInfo *getOrCreateJumpTableInfo(unsigned JTEntryKind);
587 
588  /// getConstantPool - Return the constant pool object for the current
589  /// function.
592 
593  /// getWasmEHFuncInfo - Return information about how the current function uses
594  /// Wasm exception handling. Returns null for functions that don't use wasm
595  /// exception handling.
596  const WasmEHFuncInfo *getWasmEHFuncInfo() const { return WasmEHInfo; }
597  WasmEHFuncInfo *getWasmEHFuncInfo() { return WasmEHInfo; }
598 
599  /// getWinEHFuncInfo - Return information about how the current function uses
600  /// Windows exception handling. Returns null for functions that don't use
601  /// funclets for exception handling.
602  const WinEHFuncInfo *getWinEHFuncInfo() const { return WinEHInfo; }
603  WinEHFuncInfo *getWinEHFuncInfo() { return WinEHInfo; }
604 
605  /// getAlignment - Return the alignment of the function.
606  Align getAlignment() const { return Alignment; }
607 
608  /// setAlignment - Set the alignment of the function.
609  void setAlignment(Align A) { Alignment = A; }
610 
611  /// ensureAlignment - Make sure the function is at least A bytes aligned.
613  if (Alignment < A)
614  Alignment = A;
615  }
616 
617  /// exposesReturnsTwice - Returns true if the function calls setjmp or
618  /// any other similar functions with attribute "returns twice" without
619  /// having the attribute itself.
620  bool exposesReturnsTwice() const {
621  return ExposesReturnsTwice;
622  }
623 
624  /// setCallsSetJmp - Set a flag that indicates if there's a call to
625  /// a "returns twice" function.
627  ExposesReturnsTwice = B;
628  }
629 
630  /// Returns true if the function contains any inline assembly.
631  bool hasInlineAsm() const {
632  return HasInlineAsm;
633  }
634 
635  /// Set a flag that indicates that the function contains inline assembly.
636  void setHasInlineAsm(bool B) {
637  HasInlineAsm = B;
638  }
639 
640  bool hasWinCFI() const {
641  return HasWinCFI;
642  }
643  void setHasWinCFI(bool v) { HasWinCFI = v; }
644 
645  /// True if this function needs frame moves for debug or exceptions.
646  bool needsFrameMoves() const;
647 
648  /// Get the function properties
649  const MachineFunctionProperties &getProperties() const { return Properties; }
650  MachineFunctionProperties &getProperties() { return Properties; }
651 
652  /// getInfo - Keep track of various per-function pieces of information for
653  /// backends that would like to do so.
654  ///
655  template<typename Ty>
656  Ty *getInfo() {
657  if (!MFInfo)
658  MFInfo = Ty::template create<Ty>(Allocator, *this);
659  return static_cast<Ty*>(MFInfo);
660  }
661 
662  template<typename Ty>
663  const Ty *getInfo() const {
664  return const_cast<MachineFunction*>(this)->getInfo<Ty>();
665  }
666 
667  /// Returns the denormal handling type for the default rounding mode of the
668  /// function.
669  DenormalMode getDenormalMode(const fltSemantics &FPType) const;
670 
671  /// getBlockNumbered - MachineBasicBlocks are automatically numbered when they
672  /// are inserted into the machine function. The block number for a machine
673  /// basic block can be found by using the MBB::getNumber method, this method
674  /// provides the inverse mapping.
676  assert(N < MBBNumbering.size() && "Illegal block number");
677  assert(MBBNumbering[N] && "Block was removed from the machine function!");
678  return MBBNumbering[N];
679  }
680 
681  /// Should we be emitting segmented stack stuff for the function
682  bool shouldSplitStack() const;
683 
684  /// getNumBlockIDs - Return the number of MBB ID's allocated.
685  unsigned getNumBlockIDs() const { return (unsigned)MBBNumbering.size(); }
686 
687  /// RenumberBlocks - This discards all of the MachineBasicBlock numbers and
688  /// recomputes them. This guarantees that the MBB numbers are sequential,
689  /// dense, and match the ordering of the blocks within the function. If a
690  /// specific MachineBasicBlock is specified, only that block and those after
691  /// it are renumbered.
692  void RenumberBlocks(MachineBasicBlock *MBBFrom = nullptr);
693 
694  /// print - Print out the MachineFunction in a format suitable for debugging
695  /// to the specified stream.
696  void print(raw_ostream &OS, const SlotIndexes* = nullptr) const;
697 
698  /// viewCFG - This function is meant for use from the debugger. You can just
699  /// say 'call F->viewCFG()' and a ghostview window should pop up from the
700  /// program, displaying the CFG of the current function with the code for each
701  /// basic block inside. This depends on there being a 'dot' and 'gv' program
702  /// in your path.
703  void viewCFG() const;
704 
705  /// viewCFGOnly - This function is meant for use from the debugger. It works
706  /// just like viewCFG, but it does not include the contents of basic blocks
707  /// into the nodes, just the label. If you are only interested in the CFG
708  /// this can make the graph smaller.
709  ///
710  void viewCFGOnly() const;
711 
712  /// dump - Print the current MachineFunction to cerr, useful for debugger use.
713  void dump() const;
714 
715  /// Run the current MachineFunction through the machine code verifier, useful
716  /// for debugger use.
717  /// \returns true if no problems were found.
718  bool verify(Pass *p = nullptr, const char *Banner = nullptr,
719  bool AbortOnError = true) const;
720 
721  // Provide accessors for the MachineBasicBlock list...
726 
727  /// Support for MachineBasicBlock::getNextNode().
730  return &MachineFunction::BasicBlocks;
731  }
732 
733  /// addLiveIn - Add the specified physical register as a live-in value and
734  /// create a corresponding virtual register for it.
736 
737  //===--------------------------------------------------------------------===//
738  // BasicBlock accessor functions.
739  //
740  iterator begin() { return BasicBlocks.begin(); }
741  const_iterator begin() const { return BasicBlocks.begin(); }
742  iterator end () { return BasicBlocks.end(); }
743  const_iterator end () const { return BasicBlocks.end(); }
744 
745  reverse_iterator rbegin() { return BasicBlocks.rbegin(); }
746  const_reverse_iterator rbegin() const { return BasicBlocks.rbegin(); }
747  reverse_iterator rend () { return BasicBlocks.rend(); }
748  const_reverse_iterator rend () const { return BasicBlocks.rend(); }
749 
750  unsigned size() const { return (unsigned)BasicBlocks.size();}
751  bool empty() const { return BasicBlocks.empty(); }
752  const MachineBasicBlock &front() const { return BasicBlocks.front(); }
753  MachineBasicBlock &front() { return BasicBlocks.front(); }
754  const MachineBasicBlock & back() const { return BasicBlocks.back(); }
755  MachineBasicBlock & back() { return BasicBlocks.back(); }
756 
757  void push_back (MachineBasicBlock *MBB) { BasicBlocks.push_back (MBB); }
758  void push_front(MachineBasicBlock *MBB) { BasicBlocks.push_front(MBB); }
760  BasicBlocks.insert(MBBI, MBB);
761  }
762  void splice(iterator InsertPt, iterator MBBI) {
763  BasicBlocks.splice(InsertPt, BasicBlocks, MBBI);
764  }
766  BasicBlocks.splice(InsertPt, BasicBlocks, MBB);
767  }
768  void splice(iterator InsertPt, iterator MBBI, iterator MBBE) {
769  BasicBlocks.splice(InsertPt, BasicBlocks, MBBI, MBBE);
770  }
771 
772  void remove(iterator MBBI) { BasicBlocks.remove(MBBI); }
773  void remove(MachineBasicBlock *MBBI) { BasicBlocks.remove(MBBI); }
774  void erase(iterator MBBI) { BasicBlocks.erase(MBBI); }
775  void erase(MachineBasicBlock *MBBI) { BasicBlocks.erase(MBBI); }
776 
777  template <typename Comp>
778  void sort(Comp comp) {
779  BasicBlocks.sort(comp);
780  }
781 
782  /// Return the number of \p MachineInstrs in this \p MachineFunction.
783  unsigned getInstructionCount() const {
784  unsigned InstrCount = 0;
785  for (const MachineBasicBlock &MBB : BasicBlocks)
786  InstrCount += MBB.size();
787  return InstrCount;
788  }
789 
790  //===--------------------------------------------------------------------===//
791  // Internal functions used to automatically number MachineBasicBlocks
792 
793  /// Adds the MBB to the internal numbering. Returns the unique number
794  /// assigned to the MBB.
796  MBBNumbering.push_back(MBB);
797  return (unsigned)MBBNumbering.size()-1;
798  }
799 
800  /// removeFromMBBNumbering - Remove the specific machine basic block from our
801  /// tracker, this is only really to be used by the MachineBasicBlock
802  /// implementation.
803  void removeFromMBBNumbering(unsigned N) {
804  assert(N < MBBNumbering.size() && "Illegal basic block #");
805  MBBNumbering[N] = nullptr;
806  }
807 
808  /// CreateMachineInstr - Allocate a new MachineInstr. Use this instead
809  /// of `new MachineInstr'.
811  bool NoImplicit = false);
812 
813  /// Create a new MachineInstr which is a copy of \p Orig, identical in all
814  /// ways except the instruction has no parent, prev, or next. Bundling flags
815  /// are reset.
816  ///
817  /// Note: Clones a single instruction, not whole instruction bundles.
818  /// Does not perform target specific adjustments; consider using
819  /// TargetInstrInfo::duplicate() instead.
821 
822  /// Clones instruction or the whole instruction bundle \p Orig and insert
823  /// into \p MBB before \p InsertBefore.
824  ///
825  /// Note: Does not perform target specific adjustments; consider using
826  /// TargetInstrInfo::duplicate() intead.
828  MachineBasicBlock::iterator InsertBefore, const MachineInstr &Orig);
829 
830  /// DeleteMachineInstr - Delete the given MachineInstr.
832 
833  /// CreateMachineBasicBlock - Allocate a new MachineBasicBlock. Use this
834  /// instead of `new MachineBasicBlock'.
836 
837  /// DeleteMachineBasicBlock - Delete the given MachineBasicBlock.
839 
840  /// getMachineMemOperand - Allocate a new MachineMemOperand.
841  /// MachineMemOperands are owned by the MachineFunction and need not be
842  /// explicitly deallocated.
844  MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, uint64_t s,
845  Align base_alignment, const AAMDNodes &AAInfo = AAMDNodes(),
846  const MDNode *Ranges = nullptr, SyncScope::ID SSID = SyncScope::System,
848  AtomicOrdering FailureOrdering = AtomicOrdering::NotAtomic);
849 
850  /// getMachineMemOperand - Allocate a new MachineMemOperand by copying
851  /// an existing one, adjusting by an offset and using the given size.
852  /// MachineMemOperands are owned by the MachineFunction and need not be
853  /// explicitly deallocated.
855  int64_t Offset, uint64_t Size);
856 
857  /// getMachineMemOperand - Allocate a new MachineMemOperand by copying
858  /// an existing one, replacing only the MachinePointerInfo and size.
859  /// MachineMemOperands are owned by the MachineFunction and need not be
860  /// explicitly deallocated.
862  MachinePointerInfo &PtrInfo,
863  uint64_t Size);
864 
865  /// Allocate a new MachineMemOperand by copying an existing one,
866  /// replacing only AliasAnalysis information. MachineMemOperands are owned
867  /// by the MachineFunction and need not be explicitly deallocated.
869  const AAMDNodes &AAInfo);
870 
871  /// Allocate a new MachineMemOperand by copying an existing one,
872  /// replacing the flags. MachineMemOperands are owned
873  /// by the MachineFunction and need not be explicitly deallocated.
876 
878 
879  /// Allocate an array of MachineOperands. This is only intended for use by
880  /// internal MachineInstr functions.
882  return OperandRecycler.allocate(Cap, Allocator);
883  }
884 
885  /// Dellocate an array of MachineOperands and recycle the memory. This is
886  /// only intended for use by internal MachineInstr functions.
887  /// Cap must be the same capacity that was used to allocate the array.
889  OperandRecycler.deallocate(Cap, Array);
890  }
891 
892  /// Allocate and initialize a register mask with @p NumRegister bits.
894 
896 
897  /// Allocate and construct an extra info structure for a `MachineInstr`.
898  ///
899  /// This is allocated on the function's allocator and so lives the life of
900  /// the function.
901  MachineInstr::ExtraInfo *createMIExtraInfo(
902  ArrayRef<MachineMemOperand *> MMOs, MCSymbol *PreInstrSymbol = nullptr,
903  MCSymbol *PostInstrSymbol = nullptr, MDNode *HeapAllocMarker = nullptr);
904 
905  /// Allocate a string and populate it with the given external symbol name.
907 
908  //===--------------------------------------------------------------------===//
909  // Label Manipulation.
910 
911  /// getJTISymbol - Return the MCSymbol for the specified non-empty jump table.
912  /// If isLinkerPrivate is specified, an 'l' label is returned, otherwise a
913  /// normal 'L' label is returned.
914  MCSymbol *getJTISymbol(unsigned JTI, MCContext &Ctx,
915  bool isLinkerPrivate = false) const;
916 
917  /// getPICBaseSymbol - Return a function-local symbol to represent the PIC
918  /// base.
919  MCSymbol *getPICBaseSymbol() const;
920 
921  /// Returns a reference to a list of cfi instructions in the function's
922  /// prologue. Used to construct frame maps for debug and exception handling
923  /// comsumers.
924  const std::vector<MCCFIInstruction> &getFrameInstructions() const {
925  return FrameInstructions;
926  }
927 
928  LLVM_NODISCARD unsigned addFrameInst(const MCCFIInstruction &Inst);
929 
930  /// Returns a reference to a list of symbols immediately following calls to
931  /// _setjmp in the function. Used to construct the longjmp target table used
932  /// by Windows Control Flow Guard.
933  const std::vector<MCSymbol *> &getLongjmpTargets() const {
934  return LongjmpTargets;
935  }
936 
937  /// Add the specified symbol to the list of valid longjmp targets for Windows
938  /// Control Flow Guard.
939  void addLongjmpTarget(MCSymbol *Target) { LongjmpTargets.push_back(Target); }
940 
941  /// Returns a reference to a list of symbols that we have catchrets.
942  /// Used to construct the catchret target table used by Windows EHCont Guard.
943  const std::vector<MCSymbol *> &getCatchretTargets() const {
944  return CatchretTargets;
945  }
946 
947  /// Add the specified symbol to the list of valid catchret targets for Windows
948  /// EHCont Guard.
950  CatchretTargets.push_back(Target);
951  }
952 
953  /// \name Exception Handling
954  /// \{
955 
956  bool callsEHReturn() const { return CallsEHReturn; }
957  void setCallsEHReturn(bool b) { CallsEHReturn = b; }
958 
959  bool callsUnwindInit() const { return CallsUnwindInit; }
960  void setCallsUnwindInit(bool b) { CallsUnwindInit = b; }
961 
962  bool hasEHCatchret() const { return HasEHCatchret; }
963  void setHasEHCatchret(bool V) { HasEHCatchret = V; }
964 
965  bool hasEHScopes() const { return HasEHScopes; }
966  void setHasEHScopes(bool V) { HasEHScopes = V; }
967 
968  bool hasEHFunclets() const { return HasEHFunclets; }
969  void setHasEHFunclets(bool V) { HasEHFunclets = V; }
970 
971  /// Find or create an LandingPadInfo for the specified MachineBasicBlock.
973 
974  /// Remap landing pad labels and remove any deleted landing pads.
975  void tidyLandingPads(DenseMap<MCSymbol *, uintptr_t> *LPMap = nullptr,
976  bool TidyIfNoBeginLabels = true);
977 
978  /// Return a reference to the landing pad info for the current function.
979  const std::vector<LandingPadInfo> &getLandingPads() const {
980  return LandingPads;
981  }
982 
983  /// Provide the begin and end labels of an invoke style call and associate it
984  /// with a try landing pad block.
985  void addInvoke(MachineBasicBlock *LandingPad,
986  MCSymbol *BeginLabel, MCSymbol *EndLabel);
987 
988  /// Add a new panding pad, and extract the exception handling information from
989  /// the landingpad instruction. Returns the label ID for the landing pad
990  /// entry.
992 
993  /// Provide the catch typeinfo for a landing pad.
994  void addCatchTypeInfo(MachineBasicBlock *LandingPad,
996 
997  /// Provide the filter typeinfo for a landing pad.
998  void addFilterTypeInfo(MachineBasicBlock *LandingPad,
1000 
1001  /// Add a cleanup action for a landing pad.
1002  void addCleanup(MachineBasicBlock *LandingPad);
1003 
1004  void addSEHCatchHandler(MachineBasicBlock *LandingPad, const Function *Filter,
1005  const BlockAddress *RecoverBA);
1006 
1007  void addSEHCleanupHandler(MachineBasicBlock *LandingPad,
1008  const Function *Cleanup);
1009 
1010  /// Return the type id for the specified typeinfo. This is function wide.
1011  unsigned getTypeIDFor(const GlobalValue *TI);
1012 
1013  /// Return the id of the filter encoded by TyIds. This is function wide.
1014  int getFilterIDFor(std::vector<unsigned> &TyIds);
1015 
1016  /// Map the landing pad's EH symbol to the call site indexes.
1018 
1019  /// Map the landing pad to its index. Used for Wasm exception handling.
1020  void setWasmLandingPadIndex(const MachineBasicBlock *LPad, unsigned Index) {
1021  WasmLPadToIndexMap[LPad] = Index;
1022  }
1023 
1024  /// Returns true if the landing pad has an associate index in wasm EH.
1025  bool hasWasmLandingPadIndex(const MachineBasicBlock *LPad) const {
1026  return WasmLPadToIndexMap.count(LPad);
1027  }
1028 
1029  /// Get the index in wasm EH for a given landing pad.
1030  unsigned getWasmLandingPadIndex(const MachineBasicBlock *LPad) const {
1032  return WasmLPadToIndexMap.lookup(LPad);
1033  }
1034 
1035  /// Get the call site indexes for a landing pad EH symbol.
1038  "missing call site number for landing pad!");
1039  return LPadToCallSiteMap[Sym];
1040  }
1041 
1042  /// Return true if the landing pad Eh symbol has an associated call site.
1044  return !LPadToCallSiteMap[Sym].empty();
1045  }
1046 
1047  /// Map the begin label for a call site.
1048  void setCallSiteBeginLabel(MCSymbol *BeginLabel, unsigned Site) {
1049  CallSiteMap[BeginLabel] = Site;
1050  }
1051 
1052  /// Get the call site number for a begin label.
1053  unsigned getCallSiteBeginLabel(MCSymbol *BeginLabel) const {
1054  assert(hasCallSiteBeginLabel(BeginLabel) &&
1055  "Missing call site number for EH_LABEL!");
1056  return CallSiteMap.lookup(BeginLabel);
1057  }
1058 
1059  /// Return true if the begin label has a call site number associated with it.
1060  bool hasCallSiteBeginLabel(MCSymbol *BeginLabel) const {
1061  return CallSiteMap.count(BeginLabel);
1062  }
1063 
1064  /// Record annotations associated with a particular label.
1066  CodeViewAnnotations.push_back({Label, MD});
1067  }
1068 
1070  return CodeViewAnnotations;
1071  }
1072 
1073  /// Return a reference to the C++ typeinfo for the current function.
1074  const std::vector<const GlobalValue *> &getTypeInfos() const {
1075  return TypeInfos;
1076  }
1077 
1078  /// Return a reference to the typeids encoding filters used in the current
1079  /// function.
1080  const std::vector<unsigned> &getFilterIds() const {
1081  return FilterIds;
1082  }
1083 
1084  /// \}
1085 
1086  /// Collect information used to emit debugging information of a variable.
1087  void setVariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr,
1088  int Slot, const DILocation *Loc) {
1089  VariableDbgInfos.emplace_back(Var, Expr, Slot, Loc);
1090  }
1091 
1094  return VariableDbgInfos;
1095  }
1096 
1097  /// Start tracking the arguments passed to the call \p CallI.
1101  bool Inserted =
1102  CallSitesInfo.try_emplace(CallI, std::move(CallInfo)).second;
1103  (void)Inserted;
1104  assert(Inserted && "Call site info not unique");
1105  }
1106 
1108  return CallSitesInfo;
1109  }
1110 
1111  /// Following functions update call site info. They should be called before
1112  /// removing, replacing or copying call instruction.
1113 
1114  /// Erase the call site info for \p MI. It is used to remove a call
1115  /// instruction from the instruction stream.
1116  void eraseCallSiteInfo(const MachineInstr *MI);
1117  /// Copy the call site info from \p Old to \ New. Its usage is when we are
1118  /// making a copy of the instruction that will be inserted at different point
1119  /// of the instruction stream.
1120  void copyCallSiteInfo(const MachineInstr *Old,
1121  const MachineInstr *New);
1122 
1123  const std::vector<char> &getBBSectionsSymbolPrefix() const {
1124  return BBSectionsSymbolPrefix;
1125  }
1126 
1127  /// Move the call site info from \p Old to \New call site info. This function
1128  /// is used when we are replacing one call instruction with another one to
1129  /// the same callee.
1130  void moveCallSiteInfo(const MachineInstr *Old,
1131  const MachineInstr *New);
1132 
1133  unsigned getNewDebugInstrNum() {
1134  return ++DebugInstrNumberingCount;
1135  }
1136 };
1137 
1138 //===--------------------------------------------------------------------===//
1139 // GraphTraits specializations for function basic block graphs (CFGs)
1140 //===--------------------------------------------------------------------===//
1141 
1142 // Provide specializations of GraphTraits to be able to treat a
1143 // machine function as a graph of machine basic blocks... these are
1144 // the same as the machine basic block iterators, except that the root
1145 // node is implicitly the first node of the function.
1146 //
1147 template <> struct GraphTraits<MachineFunction*> :
1149  static NodeRef getEntryNode(MachineFunction *F) { return &F->front(); }
1150 
1151  // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
1153 
1155  return nodes_iterator(F->begin());
1156  }
1157 
1159  return nodes_iterator(F->end());
1160  }
1161 
1162  static unsigned size (MachineFunction *F) { return F->size(); }
1163 };
1164 template <> struct GraphTraits<const MachineFunction*> :
1166  static NodeRef getEntryNode(const MachineFunction *F) { return &F->front(); }
1167 
1168  // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
1170 
1172  return nodes_iterator(F->begin());
1173  }
1174 
1176  return nodes_iterator(F->end());
1177  }
1178 
1179  static unsigned size (const MachineFunction *F) {
1180  return F->size();
1181  }
1182 };
1183 
1184 // Provide specializations of GraphTraits to be able to treat a function as a
1185 // graph of basic blocks... and to walk it in inverse order. Inverse order for
1186 // a function is considered to be when traversing the predecessor edges of a BB
1187 // instead of the successor edges.
1188 //
1189 template <> struct GraphTraits<Inverse<MachineFunction*>> :
1192  return &G.Graph->front();
1193  }
1194 };
1195 template <> struct GraphTraits<Inverse<const MachineFunction*>> :
1198  return &G.Graph->front();
1199  }
1200 };
1201 
1202 class MachineFunctionAnalysisManager;
1203 void verifyMachineFunction(MachineFunctionAnalysisManager *,
1204  const std::string &Banner,
1205  const MachineFunction &MF);
1206 
1207 } // end namespace llvm
1208 
1209 #endif // LLVM_CODEGEN_MACHINEFUNCTION_H
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
llvm::MachineFunction::hasWinCFI
bool hasWinCFI() const
Definition: MachineFunction.h:640
llvm::MachineFunction::remove
void remove(iterator MBBI)
Definition: MachineFunction.h:772
llvm::MachineFunction::hasInlineAsm
bool hasInlineAsm() const
Returns true if the function contains any inline assembly.
Definition: MachineFunction.h:631
llvm::WasmEHFuncInfo
Definition: WasmEHFuncInfo.h:32
llvm::MachineFunctionProperties::hasProperty
bool hasProperty(Property P) const
Definition: MachineFunction.h:165
llvm::MachineFunction::resetDelegate
void resetDelegate(Delegate *delegate)
Reset the currently registered delegate - otherwise assert.
Definition: MachineFunction.h:489
llvm::MachineFunction::getInfo
const Ty * getInfo() const
Definition: MachineFunction.h:663
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:100
MachineInstr.h
llvm
Definition: AllocatorList.h:23
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:650
Pass
print lazy value Lazy Value Info Printer Pass
Definition: LazyValueInfo.cpp:1949
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:1042
llvm::DataLayout
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:112
llvm::MachineFunction::getVariableDbgInfo
VariableDbgInfoMapTy & getVariableDbgInfo()
Definition: MachineFunction.h:1092
llvm::MachineFunction::DebugInstrOperandPair
std::pair< unsigned, unsigned > DebugInstrOperandPair
Pair of instruction number and operand number.
Definition: MachineFunction.h:452
llvm::MachineFunction::getBBSectionsSymbolPrefix
const std::vector< char > & getBBSectionsSymbolPrefix() const
Definition: MachineFunction.h:1123
llvm::MachineFunction::allocateRegMask
uint32_t * allocateRegMask()
Allocate and initialize a register mask with NumRegister bits.
Definition: MachineFunction.cpp:502
llvm::MachineFunctionProperties::print
void print(raw_ostream &OS) const
Print the MachineFunctionProperties in human-readable form.
Definition: MachineFunction.cpp:109
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:71
llvm::Function
Definition: Function.h:61
llvm::MachineFunctionProperties::Property
Property
Definition: MachineFunction.h:152
llvm::MachineFunction::getContext
MCContext & getContext() const
Definition: MachineFunction.h:510
llvm::MachineFunction::VariableDbgInfo::VariableDbgInfo
VariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr, int Slot, const DILocation *Loc)
Definition: MachineFunction.h:390
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:563
llvm::MachineFunction::assignBeginEndSections
void assignBeginEndSections()
Assign IsBeginSection IsEndSection fields for basic blocks in this function.
Definition: MachineFunction.cpp:334
llvm::Target
Target - Wrapper for Target specific information.
Definition: TargetRegistry.h:124
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:742
llvm::MachineFunction::getObserver
GISelChangeObserver * getObserver() const
Definition: MachineFunction.h:507
llvm::LandingPadInfo::LandingPadLabel
MCSymbol * LandingPadLabel
Definition: MachineFunction.h:223
llvm::MachineFunction::splice
void splice(iterator InsertPt, MachineBasicBlock *MBB)
Definition: MachineFunction.h:765
llvm::MachineFunction::getMachineMemOperand
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, uint64_t s, Align base_alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
Definition: MachineFunction.cpp:430
llvm::MachineFunction::copyCallSiteInfo
void copyCallSiteInfo(const MachineInstr *Old, const MachineInstr *New)
Copy the call site info from Old to \ New.
Definition: MachineFunction.cpp:911
llvm::LandingPadInfo::SEHHandlers
SmallVector< SEHHandler, 1 > SEHHandlers
Definition: MachineFunction.h:222
llvm::MachineFunction::exposesReturnsTwice
bool exposesReturnsTwice() const
exposesReturnsTwice - Returns true if the function calls setjmp or any other similar functions with a...
Definition: MachineFunction.h:620
Allocator.h
llvm::MachineFunction::getOrCreateJumpTableInfo
MachineJumpTableInfo * getOrCreateJumpTableInfo(unsigned JTEntryKind)
getOrCreateJumpTableInfo - Get the JumpTableInfo for this function, if it does already exist,...
Definition: MachineFunction.cpp:267
llvm::MachineFunction::getFunctionNumber
unsigned getFunctionNumber() const
getFunctionNumber - Return a unique ID for the current function.
Definition: MachineFunction.h:533
llvm::MachineFunction::setCallsUnwindInit
void setCallsUnwindInit(bool b)
Definition: MachineFunction.h:960
llvm::MachineFunction::back
const MachineBasicBlock & back() const
Definition: MachineFunction.h:754
MachineBasicBlock.h
llvm::ConstantPool
Definition: ConstantPools.h:43
llvm::iplist_impl< simple_ilist< T, Options... >, ilist_traits< T > >::const_reverse_iterator
base_list_type::const_reverse_iterator const_reverse_iterator
Definition: ilist.h:181
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:685
llvm::MachineFunction::ensureAlignment
void ensureAlignment(Align A)
ensureAlignment - Make sure the function is at least A bytes aligned.
Definition: MachineFunction.h:612
llvm::MachineFunction::moveCallSiteInfo
void moveCallSiteInfo(const MachineInstr *Old, const MachineInstr *New)
Move the call site info from Old to \New call site info.
Definition: MachineFunction.cpp:929
InstrCount
static unsigned InstrCount
Definition: DFAPacketizer.cpp:53
llvm::DILocation
Debug location.
Definition: DebugInfoMetadata.h:1558
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:758
llvm::DenseMapIterator
Definition: DenseMap.h:56
llvm::MachineFunction::Delegate::MF_HandleRemoval
virtual void MF_HandleRemoval(MachineInstr &MI)=0
Callback before a removal. This should not modify the MI directly.
llvm::MachineFunction::getInstructionCount
unsigned getInstructionCount() const
Return the number of MachineInstrs in this MachineFunction.
Definition: MachineFunction.h:783
DenseMap.h
llvm::MachineFunction::getNewDebugInstrNum
unsigned getNewDebugInstrNum()
Definition: MachineFunction.h:1133
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:759
llvm::MachineFunction::getPSVManager
PseudoSourceValueManager & getPSVManager() const
Definition: MachineFunction.h:518
llvm::MachineFunction::setCallSiteLandingPad
void setCallSiteLandingPad(MCSymbol *Sym, ArrayRef< unsigned > Sites)
Map the landing pad's EH symbol to the call site indexes.
Definition: MachineFunction.cpp:836
llvm::MachineFunctionProperties::Property::IsSSA
@ IsSSA
llvm::AMDGPU::Exp::Target
Target
Definition: SIDefines.h:732
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:497
llvm::MachineFunction::callsUnwindInit
bool callsUnwindInit() const
Definition: MachineFunction.h:959
llvm::MachineFunction::addCodeViewAnnotation
void addCodeViewAnnotation(MCSymbol *Label, MDNode *MD)
Record annotations associated with a particular label.
Definition: MachineFunction.h:1065
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:81
llvm::MachineFunction::addSEHCatchHandler
void addSEHCatchHandler(MachineBasicBlock *LandingPad, const Function *Filter, const BlockAddress *RecoverBA)
Definition: MachineFunction.cpp:817
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:1043
llvm::MachineFunction::getFunction
const Function & getFunction() const
Return the LLVM function that this machine code represents.
Definition: MachineFunction.h:527
llvm::DIExpression
DWARF expression.
Definition: DebugInfoMetadata.h:2559
llvm::MachineFunction::getJTISymbol
MCSymbol * getJTISymbol(unsigned JTI, MCContext &Ctx, bool isLinkerPrivate=false) const
getJTISymbol - Return the MCSymbol for the specified non-empty jump table.
Definition: MachineFunction.cpp:659
llvm::MachineFunction::setHasEHFunclets
void setHasEHFunclets(bool V)
Definition: MachineFunction.h:969
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:211
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::MachineFunction::iterator
BasicBlockListType::iterator iterator
Definition: MachineFunction.h:722
llvm::iplist_impl::erase
iterator erase(iterator where)
Definition: ilist.h:267
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:924
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:1158
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:626
GraphTraits.h
clear
static void clear(coro::Shape &Shape)
Definition: Coroutines.cpp:233
llvm::ARMBuildAttrs::Section
@ Section
Legacy Tags.
Definition: ARMBuildAttributes.h:78
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:1020
llvm::MachineFunction::rend
reverse_iterator rend()
Definition: MachineFunction.h:747
Arg
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
Definition: AMDGPULibCalls.cpp:205
llvm::MachineFunction::ArgRegPair::ArgNo
uint16_t ArgNo
Definition: MachineFunction.h:412
llvm::verifyMachineFunction
void verifyMachineFunction(MachineFunctionAnalysisManager *, const std::string &Banner, const MachineFunction &MF)
Definition: MachineVerifier.cpp:308
llvm::CallInfo
Definition: GVNHoist.cpp:217
llvm::GraphTraits< MachineFunction * >::nodes_begin
static nodes_iterator nodes_begin(MachineFunction *F)
Definition: MachineFunction.h:1154
llvm::MachineFunction::ArgRegPair
Structure used to represent pair of argument number after call lowering and register used to transfer...
Definition: MachineFunction.h:410
llvm::MachineFunction::substituteDebugValuesForInst
void substituteDebugValuesForInst(const MachineInstr &Old, MachineInstr &New, unsigned MaxOperand=UINT_MAX)
Create substitutions for any tracked values in Old, to point at New.
Definition: MachineFunction.cpp:959
llvm::GraphTraits< const MachineFunction * >::nodes_end
static nodes_iterator nodes_end(const MachineFunction *F)
Definition: MachineFunction.h:1175
bb
< i1 > br i1 label label bb bb
Definition: README.txt:978
llvm::MachineFunction::front
const MachineBasicBlock & front() const
Definition: MachineFunction.h:752
llvm::MachineFunction::ArgRegPair::ArgRegPair
ArgRegPair(Register R, unsigned Arg)
Definition: MachineFunction.h:413
llvm::MachineFunction::getRegInfo
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Definition: MachineFunction.h:568
llvm::MachineFunction::setSection
void setSection(MCSection *S)
Indicates the Section this function belongs to.
Definition: MachineFunction.h:516
llvm::MachineFunctionProperties::Property::Selected
@ Selected
llvm::MachineFunction::VariableDbgInfo::Slot
int Slot
Definition: MachineFunction.h:387
llvm::LandingPadInfo::EndLabels
SmallVector< MCSymbol *, 1 > EndLabels
Definition: MachineFunction.h:221
llvm::iplist_impl::push_front
void push_front(pointer val)
Definition: ilist.h:312
llvm::DILocalVariable
Local variable.
Definition: DebugInfoMetadata.h:3041
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:609
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:656
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:1080
llvm::MachineFunction::getDenormalMode
DenormalMode getDenormalMode(const fltSemantics &FPType) const
Returns the denormal handling type for the default rounding mode of the function.
Definition: MachineFunction.cpp:275
llvm::MachineFunction::addCatchTypeInfo
void addCatchTypeInfo(MachineBasicBlock *LandingPad, ArrayRef< const GlobalValue * > TyInfo)
Provide the catch typeinfo for a landing pad.
Definition: MachineFunction.cpp:750
llvm::MachineFunctionProperties::verifyRequiredProperties
bool verifyRequiredProperties(const MachineFunctionProperties &V) const
Definition: MachineFunction.h:197
llvm::GraphTraits< const MachineFunction * >::size
static unsigned size(const MachineFunction *F)
Definition: MachineFunction.h:1179
llvm::MachineFunction::setObserver
void setObserver(GISelChangeObserver *O)
Definition: MachineFunction.h:505
llvm::MachineFunction::DeleteMachineInstr
void DeleteMachineInstr(MachineInstr *MI)
DeleteMachineInstr - Delete the given MachineInstr.
Definition: MachineFunction.cpp:393
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:1036
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:543
llvm::MachineFunction::getProperties
const MachineFunctionProperties & getProperties() const
Get the function properties.
Definition: MachineFunction.h:649
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:224
llvm::MachineFunction::setDebugInstrNumberingCount
void setDebugInstrNumberingCount(unsigned Num)
Set value of DebugInstrNumberingCount field.
Definition: MachineFunction.cpp:948
llvm::MachineFunction::size
unsigned size() const
Definition: MachineFunction.h:750
llvm::MachineFunction::getTypeIDFor
unsigned getTypeIDFor(const GlobalValue *TI)
Return the type id for the specified typeinfo. This is function wide.
Definition: MachineFunction.cpp:841
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
llvm::MachineFunction::rbegin
reverse_iterator rbegin()
Definition: MachineFunction.h:745
llvm::MachineFunctionProperties::set
MachineFunctionProperties & set(Property P)
Definition: MachineFunction.h:169
llvm::MachineFunction::getVariableDbgInfo
const VariableDbgInfoMapTy & getVariableDbgInfo() const
Definition: MachineFunction.h:1093
llvm::MachineFunction::hasEHCatchret
bool hasEHCatchret() const
Definition: MachineFunction.h:962
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:1197
llvm::MachineFunction::viewCFG
void viewCFG() const
viewCFG - This function is meant for use from the debugger.
Definition: MachineFunction.cpp:612
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:50
llvm::MachineFunction::makeDebugValueSubstitution
void makeDebugValueSubstitution(DebugInstrOperandPair, DebugInstrOperandPair)
Create a substitution between one <instr,operand> value to a different, new value.
Definition: MachineFunction.cpp:952
llvm::MachineFunction::shouldSplitStack
bool shouldSplitStack() const
Should we be emitting segmented stack stuff for the function.
Definition: MachineFunction.cpp:280
llvm::MachineFunction::addToMBBNumbering
unsigned addToMBBNumbering(MachineBasicBlock *MBB)
Adds the MBB to the internal numbering.
Definition: MachineFunction.h:795
llvm::MachineFunction::Delegate
Definition: MachineFunction.h:395
BitVector.h
llvm::MachineFunction::begin
iterator begin()
Definition: MachineFunction.h:740
llvm::SlotIndexes
SlotIndexes pass.
Definition: SlotIndexes.h:314
llvm::MachineFunction::setHasWinCFI
void setHasWinCFI(bool v)
Definition: MachineFunction.h:643
llvm::MachineFunction::addFilterTypeInfo
void addFilterTypeInfo(MachineBasicBlock *LandingPad, ArrayRef< const GlobalValue * > TyInfo)
Provide the filter typeinfo for a landing pad.
Definition: MachineFunction.cpp:757
llvm::BitVector
Definition: BitVector.h:74
llvm::BasicBlockSection::All
@ All
llvm::MachineFunction::verify
bool verify(Pass *p=nullptr, const char *Banner=nullptr, bool AbortOnError=true) const
Run the current MachineFunction through the machine code verifier, useful for debugger use.
Definition: MachineVerifier.cpp:321
llvm::MachineFunction::getWasmEHFuncInfo
const WasmEHFuncInfo * getWasmEHFuncInfo() const
getWasmEHFuncInfo - Return information about how the current function uses Wasm exception handling.
Definition: MachineFunction.h:596
llvm::MachineFunction::sort
void sort(Comp comp)
Definition: MachineFunction.h:778
llvm::MachineFunction::removeFromMBBNumbering
void removeFromMBBNumbering(unsigned N)
removeFromMBBNumbering - Remove the specific machine basic block from our tracker,...
Definition: MachineFunction.h:803
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
llvm::MachineFunction::tidyLandingPads
void tidyLandingPads(DenseMap< MCSymbol *, uintptr_t > *LPMap=nullptr, bool TidyIfNoBeginLabels=true)
Remap landing pad labels and remove any deleted landing pads.
Definition: MachineFunction.cpp:766
llvm::MachineFunction::addInvoke
void addInvoke(MachineBasicBlock *LandingPad, MCSymbol *BeginLabel, MCSymbol *EndLabel)
Provide the begin and end labels of an invoke style call and associate it with a try landing pad bloc...
Definition: MachineFunction.cpp:696
llvm::iplist_impl< simple_ilist< T, Options... >, ilist_traits< T > >::reverse_iterator
base_list_type::reverse_iterator reverse_iterator
Definition: ilist.h:179
llvm::MCCFIInstruction
Definition: MCDwarf.h:441
llvm::MachineFunctionProperties::reset
MachineFunctionProperties & reset(const MachineFunctionProperties &MFP)
Definition: MachineFunction.h:190
llvm::MachineBasicBlock
Definition: MachineBasicBlock.h:95
llvm::GraphTraits< MachineFunction * >::getEntryNode
static NodeRef getEntryNode(MachineFunction *F)
Definition: MachineFunction.h:1149
llvm::MachineFunction::viewCFGOnly
void viewCFGOnly() const
viewCFGOnly - This function is meant for use from the debugger.
Definition: MachineFunction.cpp:622
llvm::MachineFunction::getConstantPool
const MachineConstantPool * getConstantPool() const
Definition: MachineFunction.h:591
llvm::MachineFunction::VariableDbgInfo::Expr
const DIExpression * Expr
Definition: MachineFunction.h:385
llvm::ilist_traits
Template traits for intrusive list.
Definition: ilist.h:89
llvm::MachineFunctionProperties::Property::NoVRegs
@ NoVRegs
llvm::MachineFunctionProperties::set
MachineFunctionProperties & set(const MachineFunctionProperties &MFP)
Definition: MachineFunction.h:185
llvm::ISD::BlockAddress
@ BlockAddress
Definition: ISDOpcodes.h:77
llvm::MachineFunction::getMMI
MachineModuleInfo & getMMI() const
Definition: MachineFunction.h:509
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:888
llvm::MachineFunction::getSubtarget
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Definition: MachineFunction.h:558
llvm::pointer_iterator
Definition: iterator.h:320
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:636
llvm::MachineFunction::rend
const_reverse_iterator rend() const
Definition: MachineFunction.h:748
llvm::MachineFunction::push_back
void push_back(MachineBasicBlock *MBB)
Definition: MachineFunction.h:757
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:132
llvm::MachineFunction::setCallSiteBeginLabel
void setCallSiteBeginLabel(MCSymbol *BeginLabel, unsigned Site)
Map the begin label for a call site.
Definition: MachineFunction.h:1048
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:1098
llvm::LandingPadInfo::BeginLabels
SmallVector< MCSymbol *, 1 > BeginLabels
Definition: MachineFunction.h:220
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:180
llvm::MachineFunction::callsEHReturn
bool callsEHReturn() const
Definition: MachineFunction.h:956
llvm::MachineFunction::createMIExtraInfo
MachineInstr::ExtraInfo * createMIExtraInfo(ArrayRef< MachineMemOperand * > MMOs, MCSymbol *PreInstrSymbol=nullptr, MCSymbol *PostInstrSymbol=nullptr, MDNode *HeapAllocMarker=nullptr)
Allocate and construct an extra info structure for a MachineInstr.
Definition: MachineFunction.cpp:488
llvm::MachineFunction::front
MachineBasicBlock & front()
Definition: MachineFunction.h:753
llvm::MachineFunction::setHasEHCatchret
void setHasEHCatchret(bool V)
Definition: MachineFunction.h:963
const
aarch64 promote const
Definition: AArch64PromoteConstant.cpp:232
llvm::MachineFunction::addSEHCleanupHandler
void addSEHCleanupHandler(MachineBasicBlock *LandingPad, const Function *Cleanup)
Definition: MachineFunction.cpp:827
llvm::MachineFunction::CloneMachineInstr
MachineInstr * CloneMachineInstr(const MachineInstr *Orig)
Create a new MachineInstr which is a copy of Orig, identical in all ways except the instruction has n...
Definition: MachineFunction.cpp:358
llvm::BasicBlockSection::Preset
@ Preset
llvm::iplist_impl< simple_ilist< T, Options... >, ilist_traits< T > >::iterator
base_list_type::iterator iterator
Definition: ilist.h:177
llvm::MachineFunction::back
MachineBasicBlock & back()
Definition: MachineFunction.h:755
s
multiplies can be turned into SHL s
Definition: README.txt:370
llvm::MachineFunction::splice
void splice(iterator InsertPt, iterator MBBI)
Definition: MachineFunction.h:762
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:37
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
llvm::MachineFunction::dump
void dump() const
dump - Print the current MachineFunction to cerr, useful for debugger use.
Definition: MachineFunction.cpp:517
iterator.h
llvm::MachineFunction::getCallSitesInfo
const CallSiteInfoMap & getCallSitesInfo() const
Definition: MachineFunction.h:1107
llvm::GraphTraits< const MachineFunction * >::getEntryNode
static NodeRef getEntryNode(const MachineFunction *F)
Definition: MachineFunction.h:1166
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:443
llvm::GraphTraits< const MachineBasicBlock * >
Definition: MachineBasicBlock.h:1051
llvm::ilist_alloc_traits
Use delete by default for iplist and ilist.
Definition: ilist.h:40
llvm::MachineFunction::CreateMachineBasicBlock
MachineBasicBlock * CreateMachineBasicBlock(const BasicBlock *bb=nullptr)
CreateMachineBasicBlock - Allocate a new MachineBasicBlock.
Definition: MachineFunction.cpp:414
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::getName
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
Definition: MachineFunction.cpp:522
llvm::MachineFunction::getConstantPool
MachineConstantPool * getConstantPool()
getConstantPool - Return the constant pool object for the current function.
Definition: MachineFunction.h:590
llvm::MachineFunction::~MachineFunction
~MachineFunction()
Definition: MachineFunction.cpp:210
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::LandingPadInfo::LandingPadBlock
MachineBasicBlock * LandingPadBlock
Definition: MachineFunction.h:219
llvm::MachineFunction::getCodeViewAnnotations
ArrayRef< std::pair< MCSymbol *, MDNode * > > getCodeViewAnnotations() const
Definition: MachineFunction.h:1069
llvm::MachineFunction::getFrameInfo
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
Definition: MachineFunction.h:574
llvm::SyncScope::System
@ System
Synchronized with respect to all concurrently executing threads.
Definition: LLVMContext.h:58
llvm::MachineFunction::getLandingPads
const std::vector< LandingPadInfo > & getLandingPads() const
Return a reference to the landing pad info for the current function.
Definition: MachineFunction.h:979
llvm::MachineFunction::erase
void erase(iterator MBBI)
Definition: MachineFunction.h:774
llvm::ISD::BasicBlock
@ BasicBlock
Various leaf nodes.
Definition: ISDOpcodes.h:64
llvm::Recycler
Recycler - This class manages a linked-list of deallocated nodes and facilitates reusing deallocated ...
Definition: Recycler.h:34
llvm::MachineFunction::DebugValueSubstitutions
std::map< DebugInstrOperandPair, DebugInstrOperandPair > DebugValueSubstitutions
Substitution map: from one <inst,operand> pair to another.
Definition: MachineFunction.h:458
llvm::MDNode
Metadata node.
Definition: Metadata.h:897
llvm::MachineFunction::begin
const_iterator begin() const
Definition: MachineFunction.h:741
llvm::MachineFunction
Definition: MachineFunction.h:230
llvm::MachineFunction::addLiveIn
Register addLiveIn(MCRegister PReg, const TargetRegisterClass *RC)
addLiveIn - Add the specified physical register as a live-in value and create a corresponding virtual...
Definition: MachineFunction.cpp:634
llvm::MachineFunction::getWasmEHFuncInfo
WasmEHFuncInfo * getWasmEHFuncInfo()
Definition: MachineFunction.h:597
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:847
llvm::MachineFunction::OperandCapacity
ArrayRecycler< MachineOperand >::Capacity OperandCapacity
Definition: MachineFunction.h:877
llvm::GraphTraits< const MachineFunction * >::nodes_begin
static nodes_iterator nodes_begin(const MachineFunction *F)
Definition: MachineFunction.h:1171
llvm::MachineFunction::rbegin
const_reverse_iterator rbegin() const
Definition: MachineFunction.h:746
llvm::ArrayRef< int >
RegInfo
Definition: AMDGPUAsmParser.cpp:2355
llvm::MachineFunction::splice
void splice(iterator InsertPt, iterator MBBI, iterator MBBE)
Definition: MachineFunction.h:768
llvm::MachineFunction::DeleteMachineBasicBlock
void DeleteMachineBasicBlock(MachineBasicBlock *MBB)
DeleteMachineBasicBlock - Delete the given MachineBasicBlock.
Definition: MachineFunction.cpp:421
llvm::MachineFunction::allocateShuffleMask
ArrayRef< int > allocateShuffleMask(ArrayRef< int > Mask)
Definition: MachineFunction.cpp:510
llvm::MachineFunction::setHasEHScopes
void setHasEHScopes(bool V)
Definition: MachineFunction.h:966
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:388
MBBI
MachineBasicBlock MachineBasicBlock::iterator MBBI
Definition: AArch64SLSHardening.cpp:75
A
* A
Definition: README_ALTIVEC.txt:89
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::GraphTraits< MachineFunction * >::size
static unsigned size(MachineFunction *F)
Definition: MachineFunction.h:1162
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:536
llvm::MachineFunctionProperties::Property::TiedOpsRewritten
@ TiedOpsRewritten
llvm::MachineFunctionProperties::reset
MachineFunctionProperties & reset(Property P)
Definition: MachineFunction.h:174
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::MachineFunction::DebugInstrNumberingCount
unsigned DebugInstrNumberingCount
A count of how many instructions in the function have had numbers assigned to them.
Definition: MachineFunction.h:445
llvm::MachineFunction::CloneMachineInstrBundle
MachineInstr & CloneMachineInstrBundle(MachineBasicBlock &MBB, MachineBasicBlock::iterator InsertBefore, const MachineInstr &Orig)
Clones instruction or the whole instruction bundle Orig and insert into MBB before InsertBefore.
Definition: MachineFunction.cpp:363
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:1191
llvm::ArrayRecycler< MachineOperand >
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:513
llvm::MachineFunction::getFilterIDFor
int getFilterIDFor(std::vector< unsigned > &TyIds)
Return the id of the filter encoded by TyIds. This is function wide.
Definition: MachineFunction.cpp:849
llvm::EHPersonality::Unknown
@ Unknown
MBB
MachineBasicBlock & MBB
Definition: AArch64SLSHardening.cpp:74
llvm::MachineFunction::end
const_iterator end() const
Definition: MachineFunction.h:743
llvm::MachineFunction::getFrameInfo
const MachineFrameInfo & getFrameInfo() const
Definition: MachineFunction.h:575
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:675
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:524
llvm::MachineFunctionProperties::Property::NoPHIs
@ NoPHIs
llvm::MachineFunction::needsFrameMoves
bool needsFrameMoves() const
True if this function needs frame moves for debug or exceptions.
Definition: MachineFunction.cpp:568
uint16_t
llvm::MachineFunction::getTarget
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
Definition: MachineFunction.h:554
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:775
llvm::MachineFunction::getWinEHFuncInfo
const WinEHFuncInfo * getWinEHFuncInfo() const
getWinEHFuncInfo - Return information about how the current function uses Windows exception handling.
Definition: MachineFunction.h:602
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:949
llvm::fltSemantics
Definition: APFloat.cpp:54
llvm::MachineFunction::allocateOperandArray
MachineOperand * allocateOperandArray(OperandCapacity Cap)
Allocate an array of MachineOperands.
Definition: MachineFunction.h:881
llvm::MachineFunction::print
void print(raw_ostream &OS, const SlotIndexes *=nullptr) const
print - Print out the MachineFunction in a format suitable for debugging to the specified stream.
Definition: MachineFunction.cpp:526
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:1060
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:603
llvm::LLVMTargetMachine
This class describes a target machine that is implemented with the LLVM target-independent code gener...
Definition: TargetMachine.h:386
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:707
llvm::MachineFunction::MachineFunction
MachineFunction(Function &F, const LLVMTargetMachine &Target, const TargetSubtargetInfo &STI, unsigned FunctionNum, MachineModuleInfo &MMI)
Definition: MachineFunction.cpp:137
llvm::Inverse
Definition: GraphTraits.h:95
llvm::MachineFunction::hasEHFunclets
bool hasEHFunclets() const
Definition: MachineFunction.h:968
llvm::MachineFunction::addCleanup
void addCleanup(MachineBasicBlock *LandingPad)
Add a cleanup action for a landing pad.
Definition: MachineFunction.cpp:812
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:939
llvm::iplist_impl::insert
iterator insert(iterator where, pointer New)
Definition: ilist.h:228
llvm::MachineFunction::ArgRegPair::Reg
Register Reg
Definition: MachineFunction.h:411
llvm::MachineFunction::getPICBaseSymbol
MCSymbol * getPICBaseSymbol() const
getPICBaseSymbol - Return a function-local symbol to represent the PIC base.
Definition: MachineFunction.cpp:674
llvm::MachineFunction::addFrameInst
LLVM_NODISCARD unsigned addFrameInst(const MCCFIInstruction &Inst)
Definition: MachineFunction.cpp:285
llvm::SEHHandler
Definition: MachineFunction.h:209
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:1025
llvm::MachineFunction::reset
void reset()
Reset the instance as if it was just created.
Definition: MachineFunction.h:483
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
N
#define N
llvm::iplist_impl< simple_ilist< T, Options... >, ilist_traits< T > >::const_iterator
base_list_type::const_iterator const_iterator
Definition: ilist.h:178
llvm::DenseMapBase::try_emplace
std::pair< iterator, bool > try_emplace(KeyT &&Key, Ts &&... Args)
Definition: DenseMap.h:222
llvm::MachineFunction::getDataLayout
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
Definition: MachineFunction.cpp:260
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:1053
llvm::LandingPadInfo
This structure is used to retain landing pad info for the current function.
Definition: MachineFunction.h:218
llvm::MachineFunction::getSublistAccess
static BasicBlockListType MachineFunction::* getSublistAccess(MachineBasicBlock *)
Support for MachineBasicBlock::getNextNode().
Definition: MachineFunction.h:729
llvm::MachineFunction::remove
void remove(MachineBasicBlock *MBBI)
Definition: MachineFunction.h:773
llvm::MachineFunction::VariableDbgInfo::Var
const DILocalVariable * Var
Definition: MachineFunction.h:384
llvm::MachineFunction::getTypeInfos
const std::vector< const GlobalValue * > & getTypeInfos() const
Return a reference to the C++ typeinfo for the current function.
Definition: MachineFunction.h:1074
llvm::MachineFunction::createExternalSymbolName
const char * createExternalSymbolName(StringRef Name)
Allocate a string and populate it with the given external symbol name.
Definition: MachineFunction.cpp:495
llvm::MachineFunction::getCatchretTargets
const std::vector< MCSymbol * > & getCatchretTargets() const
Returns a reference to a list of symbols that we have catchrets.
Definition: MachineFunction.h:943
llvm::MachineFunction::getWasmLandingPadIndex
unsigned getWasmLandingPadIndex(const MachineBasicBlock *LPad) const
Get the index in wasm EH for a given landing pad.
Definition: MachineFunction.h:1030
llvm::MachineFunction::getJumpTableInfo
const MachineJumpTableInfo * getJumpTableInfo() const
getJumpTableInfo - Return the jump table info object for the current function.
Definition: MachineFunction.h:581
llvm::MachineFunction::CreateMachineInstr
MachineInstr * CreateMachineInstr(const MCInstrDesc &MCID, const DebugLoc &DL, bool NoImplicit=false)
CreateMachineInstr - Allocate a new MachineInstr.
Definition: MachineFunction.cpp:348
llvm::GraphTraits
Definition: GraphTraits.h:35
llvm::DebugLoc
A debug info location.
Definition: DebugLoc.h:33
Recycler.h
llvm::MachineFunction::addLandingPad
MCSymbol * addLandingPad(MachineBasicBlock *LandingPad)
Add a new panding pad, and extract the exception handling information from the landingpad instruction...
Definition: MachineFunction.cpp:703
llvm::MachineFunction::hasEHScopes
bool hasEHScopes() const
Definition: MachineFunction.h:965
llvm::MachineJumpTableInfo
Definition: MachineJumpTableInfo.h:42
llvm::MachineFunction::operator=
MachineFunction & operator=(const MachineFunction &)=delete
llvm::MachineFunction::VariableDbgInfo
Definition: MachineFunction.h:383
llvm::MachineFunction::empty
bool empty() const
Definition: MachineFunction.h:751
llvm::MachineFunction::eraseCallSiteInfo
void eraseCallSiteInfo(const MachineInstr *MI)
Following functions update call site info.
Definition: MachineFunction.cpp:899
llvm::MachineFunction::getJumpTableInfo
MachineJumpTableInfo * getJumpTableInfo()
Definition: MachineFunction.h:582
llvm::MachineFunction::VariableDbgInfos
VariableDbgInfoMapTy VariableDbgInfos
Definition: MachineFunction.h:440
llvm::MachineInstrBundleIterator< MachineInstr >
llvm::MachineFunction::getAlignment
Align getAlignment() const
getAlignment - Return the alignment of the function.
Definition: MachineFunction.h:606
llvm::MachineFunction::setBBSectionsType
void setBBSectionsType(BasicBlockSection V)
Definition: MachineFunction.h:547
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:214
llvm::MachineFunction::Delegate::~Delegate
virtual ~Delegate()=default
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:1087
llvm::LandingPadInfo::LandingPadInfo
LandingPadInfo(MachineBasicBlock *MBB)
Definition: MachineFunction.h:226
llvm::MachineFunction::RenumberBlocks
void RenumberBlocks(MachineBasicBlock *MBBFrom=nullptr)
RenumberBlocks - This discards all of the MachineBasicBlock numbers and recomputes them.
Definition: MachineFunction.cpp:294
llvm::MachineFunction::setCallsEHReturn
void setCallsEHReturn(bool b)
Definition: MachineFunction.h:957
llvm::MachineFunction::getOrCreateLandingPadInfo
LandingPadInfo & getOrCreateLandingPadInfo(MachineBasicBlock *LandingPad)
Find or create an LandingPadInfo for the specified MachineBasicBlock.
Definition: MachineFunction.cpp:684
llvm::AtomicOrdering::NotAtomic
@ NotAtomic
llvm::codeview::PublicSymFlags::Function
@ Function
llvm::ISD::MCSymbol
@ MCSymbol
Definition: ISDOpcodes.h:165
llvm::MachineFunction::getRegInfo
const MachineRegisterInfo & getRegInfo() const
Definition: MachineFunction.h:569
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:933
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:22
llvm::MachineFunction::Delegate::MF_HandleInsertion
virtual void MF_HandleInsertion(MachineInstr &MI)=0
Callback after an insertion. This should not modify the MI directly.
llvm::MachineFunctionProperties::Property::Legalized
@ Legalized