LLVM  3.7.0
MachineFunction.h
Go to the documentation of this file.
1 //===-- llvm/CodeGen/MachineFunction.h --------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Collect native machine code for a function. This class contains a list of
11 // MachineBasicBlock instances that make up the current compiled function.
12 //
13 // This class also contains pointers to various classes which hold
14 // target-specific information about the generated code.
15 //
16 //===----------------------------------------------------------------------===//
17 
18 #ifndef LLVM_CODEGEN_MACHINEFUNCTION_H
19 #define LLVM_CODEGEN_MACHINEFUNCTION_H
20 
21 #include "llvm/ADT/ilist.h"
23 #include "llvm/IR/DebugLoc.h"
24 #include "llvm/IR/Metadata.h"
25 #include "llvm/Support/Allocator.h"
27 #include "llvm/Support/Recycler.h"
28 
29 namespace llvm {
30 
31 class Value;
32 class Function;
33 class GCModuleInfo;
34 class MachineRegisterInfo;
35 class MachineFrameInfo;
36 class MachineConstantPool;
37 class MachineJumpTableInfo;
38 class MachineModuleInfo;
39 class MCContext;
40 class Pass;
41 class TargetMachine;
42 class TargetSubtargetInfo;
43 class TargetRegisterClass;
44 struct MachinePointerInfo;
45 
46 template <>
48  : public ilist_default_traits<MachineBasicBlock> {
50 public:
52  return static_cast<MachineBasicBlock*>(&Sentinel);
53  }
55 
58  return createSentinel();
59  }
61 
64  void deleteNode(MachineBasicBlock *MBB);
65 private:
66  void createNode(const MachineBasicBlock &);
67 };
68 
69 /// MachineFunctionInfo - This class can be derived from and used by targets to
70 /// hold private target-specific information for each MachineFunction. Objects
71 /// of type are accessed/created with MF::getInfo and destroyed when the
72 /// MachineFunction is destroyed.
74  virtual ~MachineFunctionInfo();
75 
76  /// \brief Factory function: default behavior is to call new using the
77  /// supplied allocator.
78  ///
79  /// This function can be overridden in a derive class.
80  template<typename Ty>
81  static Ty *create(BumpPtrAllocator &Allocator, MachineFunction &MF) {
82  return new (Allocator.Allocate<Ty>()) Ty(MF);
83  }
84 };
85 
87  const Function *Fn;
88  const TargetMachine &Target;
89  const TargetSubtargetInfo *STI;
90  MCContext &Ctx;
91  MachineModuleInfo &MMI;
92 
93  // RegInfo - Information about each register in use in the function.
94  MachineRegisterInfo *RegInfo;
95 
96  // Used to keep track of target-specific per-machine function information for
97  // the target implementation.
98  MachineFunctionInfo *MFInfo;
99 
100  // Keep track of objects allocated on the stack.
101  MachineFrameInfo *FrameInfo;
102 
103  // Keep track of constants which are spilled to memory
105 
106  // Keep track of jump tables for switch instructions
107  MachineJumpTableInfo *JumpTableInfo;
108 
109  // Function-level unique numbering for MachineBasicBlocks. When a
110  // MachineBasicBlock is inserted into a MachineFunction is it automatically
111  // numbered and this vector keeps track of the mapping from ID's to MBB's.
112  std::vector<MachineBasicBlock*> MBBNumbering;
113 
114  // Pool-allocate MachineFunction-lifetime and IR objects.
115  BumpPtrAllocator Allocator;
116 
117  // Allocation management for instructions in function.
118  Recycler<MachineInstr> InstructionRecycler;
119 
120  // Allocation management for operand arrays on instructions.
121  ArrayRecycler<MachineOperand> OperandRecycler;
122 
123  // Allocation management for basic blocks in function.
124  Recycler<MachineBasicBlock> BasicBlockRecycler;
125 
126  // List of machine basic blocks in function
128  BasicBlockListType BasicBlocks;
129 
130  /// FunctionNumber - This provides a unique ID for each function emitted in
131  /// this translation unit.
132  ///
133  unsigned FunctionNumber;
134 
135  /// Alignment - The alignment of the function.
136  unsigned Alignment;
137 
138  /// ExposesReturnsTwice - True if the function calls setjmp or related
139  /// functions with attribute "returns twice", but doesn't have
140  /// the attribute itself.
141  /// This is used to limit optimizations which cannot reason
142  /// about the control flow of such functions.
143  bool ExposesReturnsTwice;
144 
145  /// True if the function includes any inline assembly.
146  bool HasInlineAsm;
147 
148  MachineFunction(const MachineFunction &) = delete;
149  void operator=(const MachineFunction&) = delete;
150 public:
151  MachineFunction(const Function *Fn, const TargetMachine &TM,
152  unsigned FunctionNum, MachineModuleInfo &MMI);
154 
155  MachineModuleInfo &getMMI() const { return MMI; }
156  MCContext &getContext() const { return Ctx; }
157 
158  /// Return the DataLayout attached to the Module associated to this MF.
159  const DataLayout &getDataLayout() const;
160 
161  /// getFunction - Return the LLVM function that this machine code represents
162  ///
163  const Function *getFunction() const { return Fn; }
164 
165  /// getName - Return the name of the corresponding LLVM function.
166  ///
167  StringRef getName() const;
168 
169  /// getFunctionNumber - Return a unique ID for the current function.
170  ///
171  unsigned getFunctionNumber() const { return FunctionNumber; }
172 
173  /// getTarget - Return the target machine this machine code is compiled with
174  ///
175  const TargetMachine &getTarget() const { return Target; }
176 
177  /// getSubtarget - Return the subtarget for which this machine code is being
178  /// compiled.
179  const TargetSubtargetInfo &getSubtarget() const { return *STI; }
180  void setSubtarget(const TargetSubtargetInfo *ST) { STI = ST; }
181 
182  /// getSubtarget - This method returns a pointer to the specified type of
183  /// TargetSubtargetInfo. In debug builds, it verifies that the object being
184  /// returned is of the correct type.
185  template<typename STC> const STC &getSubtarget() const {
186  return *static_cast<const STC *>(STI);
187  }
188 
189  /// getRegInfo - Return information about the registers currently in use.
190  ///
191  MachineRegisterInfo &getRegInfo() { return *RegInfo; }
192  const MachineRegisterInfo &getRegInfo() const { return *RegInfo; }
193 
194  /// getFrameInfo - Return the frame info object for the current function.
195  /// This object contains information about objects allocated on the stack
196  /// frame of the current function in an abstract way.
197  ///
198  MachineFrameInfo *getFrameInfo() { return FrameInfo; }
199  const MachineFrameInfo *getFrameInfo() const { return FrameInfo; }
200 
201  /// getJumpTableInfo - Return the jump table info object for the current
202  /// function. This object contains information about jump tables in the
203  /// current function. If the current function has no jump tables, this will
204  /// return null.
205  const MachineJumpTableInfo *getJumpTableInfo() const { return JumpTableInfo; }
206  MachineJumpTableInfo *getJumpTableInfo() { return JumpTableInfo; }
207 
208  /// getOrCreateJumpTableInfo - Get the JumpTableInfo for this function, if it
209  /// does already exist, allocate one.
210  MachineJumpTableInfo *getOrCreateJumpTableInfo(unsigned JTEntryKind);
211 
212 
213  /// getConstantPool - Return the constant pool object for the current
214  /// function.
215  ///
218 
219  /// getAlignment - Return the alignment (log2, not bytes) of the function.
220  ///
221  unsigned getAlignment() const { return Alignment; }
222 
223  /// setAlignment - Set the alignment (log2, not bytes) of the function.
224  ///
225  void setAlignment(unsigned A) { Alignment = A; }
226 
227  /// ensureAlignment - Make sure the function is at least 1 << A bytes aligned.
228  void ensureAlignment(unsigned A) {
229  if (Alignment < A) Alignment = A;
230  }
231 
232  /// exposesReturnsTwice - Returns true if the function calls setjmp or
233  /// any other similar functions with attribute "returns twice" without
234  /// having the attribute itself.
235  bool exposesReturnsTwice() const {
236  return ExposesReturnsTwice;
237  }
238 
239  /// setCallsSetJmp - Set a flag that indicates if there's a call to
240  /// a "returns twice" function.
241  void setExposesReturnsTwice(bool B) {
242  ExposesReturnsTwice = B;
243  }
244 
245  /// Returns true if the function contains any inline assembly.
246  bool hasInlineAsm() const {
247  return HasInlineAsm;
248  }
249 
250  /// Set a flag that indicates that the function contains inline assembly.
251  void setHasInlineAsm(bool B) {
252  HasInlineAsm = B;
253  }
254 
255  /// getInfo - Keep track of various per-function pieces of information for
256  /// backends that would like to do so.
257  ///
258  template<typename Ty>
259  Ty *getInfo() {
260  if (!MFInfo)
261  MFInfo = Ty::template create<Ty>(Allocator, *this);
262  return static_cast<Ty*>(MFInfo);
263  }
264 
265  template<typename Ty>
266  const Ty *getInfo() const {
267  return const_cast<MachineFunction*>(this)->getInfo<Ty>();
268  }
269 
270  /// getBlockNumbered - MachineBasicBlocks are automatically numbered when they
271  /// are inserted into the machine function. The block number for a machine
272  /// basic block can be found by using the MBB::getBlockNumber method, this
273  /// method provides the inverse mapping.
274  ///
276  assert(N < MBBNumbering.size() && "Illegal block number");
277  assert(MBBNumbering[N] && "Block was removed from the machine function!");
278  return MBBNumbering[N];
279  }
280 
281  /// Should we be emitting segmented stack stuff for the function
282  bool shouldSplitStack();
283 
284  /// getNumBlockIDs - Return the number of MBB ID's allocated.
285  ///
286  unsigned getNumBlockIDs() const { return (unsigned)MBBNumbering.size(); }
287 
288  /// RenumberBlocks - This discards all of the MachineBasicBlock numbers and
289  /// recomputes them. This guarantees that the MBB numbers are sequential,
290  /// dense, and match the ordering of the blocks within the function. If a
291  /// specific MachineBasicBlock is specified, only that block and those after
292  /// it are renumbered.
293  void RenumberBlocks(MachineBasicBlock *MBBFrom = nullptr);
294 
295  /// print - Print out the MachineFunction in a format suitable for debugging
296  /// to the specified stream.
297  ///
298  void print(raw_ostream &OS, SlotIndexes* = nullptr) const;
299 
300  /// viewCFG - This function is meant for use from the debugger. You can just
301  /// say 'call F->viewCFG()' and a ghostview window should pop up from the
302  /// program, displaying the CFG of the current function with the code for each
303  /// basic block inside. This depends on there being a 'dot' and 'gv' program
304  /// in your path.
305  ///
306  void viewCFG() const;
307 
308  /// viewCFGOnly - This function is meant for use from the debugger. It works
309  /// just like viewCFG, but it does not include the contents of basic blocks
310  /// into the nodes, just the label. If you are only interested in the CFG
311  /// this can make the graph smaller.
312  ///
313  void viewCFGOnly() const;
314 
315  /// dump - Print the current MachineFunction to cerr, useful for debugger use.
316  ///
317  void dump() const;
318 
319  /// verify - Run the current MachineFunction through the machine code
320  /// verifier, useful for debugger use.
321  void verify(Pass *p = nullptr, const char *Banner = nullptr) const;
322 
323  // Provide accessors for the MachineBasicBlock list...
326  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
327  typedef std::reverse_iterator<iterator> reverse_iterator;
328 
329  /// addLiveIn - Add the specified physical register as a live-in value and
330  /// create a corresponding virtual register for it.
331  unsigned addLiveIn(unsigned PReg, const TargetRegisterClass *RC);
332 
333  //===--------------------------------------------------------------------===//
334  // BasicBlock accessor functions.
335  //
336  iterator begin() { return BasicBlocks.begin(); }
337  const_iterator begin() const { return BasicBlocks.begin(); }
338  iterator end () { return BasicBlocks.end(); }
339  const_iterator end () const { return BasicBlocks.end(); }
340 
341  reverse_iterator rbegin() { return BasicBlocks.rbegin(); }
342  const_reverse_iterator rbegin() const { return BasicBlocks.rbegin(); }
343  reverse_iterator rend () { return BasicBlocks.rend(); }
344  const_reverse_iterator rend () const { return BasicBlocks.rend(); }
345 
346  unsigned size() const { return (unsigned)BasicBlocks.size();}
347  bool empty() const { return BasicBlocks.empty(); }
348  const MachineBasicBlock &front() const { return BasicBlocks.front(); }
349  MachineBasicBlock &front() { return BasicBlocks.front(); }
350  const MachineBasicBlock & back() const { return BasicBlocks.back(); }
351  MachineBasicBlock & back() { return BasicBlocks.back(); }
352 
353  void push_back (MachineBasicBlock *MBB) { BasicBlocks.push_back (MBB); }
354  void push_front(MachineBasicBlock *MBB) { BasicBlocks.push_front(MBB); }
355  void insert(iterator MBBI, MachineBasicBlock *MBB) {
356  BasicBlocks.insert(MBBI, MBB);
357  }
358  void splice(iterator InsertPt, iterator MBBI) {
359  BasicBlocks.splice(InsertPt, BasicBlocks, MBBI);
360  }
361  void splice(iterator InsertPt, iterator MBBI, iterator MBBE) {
362  BasicBlocks.splice(InsertPt, BasicBlocks, MBBI, MBBE);
363  }
364 
365  void remove(iterator MBBI) {
366  BasicBlocks.remove(MBBI);
367  }
368  void erase(iterator MBBI) {
369  BasicBlocks.erase(MBBI);
370  }
371 
372  //===--------------------------------------------------------------------===//
373  // Internal functions used to automatically number MachineBasicBlocks
374  //
375 
376  /// \brief Adds the MBB to the internal numbering. Returns the unique number
377  /// assigned to the MBB.
378  ///
380  MBBNumbering.push_back(MBB);
381  return (unsigned)MBBNumbering.size()-1;
382  }
383 
384  /// removeFromMBBNumbering - Remove the specific machine basic block from our
385  /// tracker, this is only really to be used by the MachineBasicBlock
386  /// implementation.
387  void removeFromMBBNumbering(unsigned N) {
388  assert(N < MBBNumbering.size() && "Illegal basic block #");
389  MBBNumbering[N] = nullptr;
390  }
391 
392  /// CreateMachineInstr - Allocate a new MachineInstr. Use this instead
393  /// of `new MachineInstr'.
394  ///
396  DebugLoc DL,
397  bool NoImp = false);
398 
399  /// CloneMachineInstr - Create a new MachineInstr which is a copy of the
400  /// 'Orig' instruction, identical in all ways except the instruction
401  /// has no parent, prev, or next.
402  ///
403  /// See also TargetInstrInfo::duplicate() for target-specific fixes to cloned
404  /// instructions.
406 
407  /// DeleteMachineInstr - Delete the given MachineInstr.
408  ///
410 
411  /// CreateMachineBasicBlock - Allocate a new MachineBasicBlock. Use this
412  /// instead of `new MachineBasicBlock'.
413  ///
415 
416  /// DeleteMachineBasicBlock - Delete the given MachineBasicBlock.
417  ///
419 
420  /// getMachineMemOperand - Allocate a new MachineMemOperand.
421  /// MachineMemOperands are owned by the MachineFunction and need not be
422  /// explicitly deallocated.
424  unsigned f, uint64_t s,
425  unsigned base_alignment,
426  const AAMDNodes &AAInfo = AAMDNodes(),
427  const MDNode *Ranges = nullptr);
428 
429  /// getMachineMemOperand - Allocate a new MachineMemOperand by copying
430  /// an existing one, adjusting by an offset and using the given size.
431  /// MachineMemOperands are owned by the MachineFunction and need not be
432  /// explicitly deallocated.
434  int64_t Offset, uint64_t Size);
435 
437 
438  /// Allocate an array of MachineOperands. This is only intended for use by
439  /// internal MachineInstr functions.
441  return OperandRecycler.allocate(Cap, Allocator);
442  }
443 
444  /// Dellocate an array of MachineOperands and recycle the memory. This is
445  /// only intended for use by internal MachineInstr functions.
446  /// Cap must be the same capacity that was used to allocate the array.
448  OperandRecycler.deallocate(Cap, Array);
449  }
450 
451  /// \brief Allocate and initialize a register mask with @p NumRegister bits.
452  uint32_t *allocateRegisterMask(unsigned NumRegister) {
453  unsigned Size = (NumRegister + 31) / 32;
454  uint32_t *Mask = Allocator.Allocate<uint32_t>(Size);
455  for (unsigned i = 0; i != Size; ++i)
456  Mask[i] = 0;
457  return Mask;
458  }
459 
460  /// allocateMemRefsArray - Allocate an array to hold MachineMemOperand
461  /// pointers. This array is owned by the MachineFunction.
463 
464  /// extractLoadMemRefs - Allocate an array and populate it with just the
465  /// load information from the given MachineMemOperand sequence.
466  std::pair<MachineInstr::mmo_iterator,
470 
471  /// extractStoreMemRefs - Allocate an array and populate it with just the
472  /// store information from the given MachineMemOperand sequence.
473  std::pair<MachineInstr::mmo_iterator,
477 
478  //===--------------------------------------------------------------------===//
479  // Label Manipulation.
480  //
481 
482  /// getJTISymbol - Return the MCSymbol for the specified non-empty jump table.
483  /// If isLinkerPrivate is specified, an 'l' label is returned, otherwise a
484  /// normal 'L' label is returned.
485  MCSymbol *getJTISymbol(unsigned JTI, MCContext &Ctx,
486  bool isLinkerPrivate = false) const;
487 
488  /// getPICBaseSymbol - Return a function-local symbol to represent the PIC
489  /// base.
490  MCSymbol *getPICBaseSymbol() const;
491 };
492 
493 //===--------------------------------------------------------------------===//
494 // GraphTraits specializations for function basic block graphs (CFGs)
495 //===--------------------------------------------------------------------===//
496 
497 // Provide specializations of GraphTraits to be able to treat a
498 // machine function as a graph of machine basic blocks... these are
499 // the same as the machine basic block iterators, except that the root
500 // node is implicitly the first node of the function.
501 //
502 template <> struct GraphTraits<MachineFunction*> :
505  return &F->front();
506  }
507 
508  // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
510  static nodes_iterator nodes_begin(MachineFunction *F) { return F->begin(); }
511  static nodes_iterator nodes_end (MachineFunction *F) { return F->end(); }
512  static unsigned size (MachineFunction *F) { return F->size(); }
513 };
514 template <> struct GraphTraits<const MachineFunction*> :
517  return &F->front();
518  }
519 
520  // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
522  static nodes_iterator nodes_begin(const MachineFunction *F) {
523  return F->begin();
524  }
525  static nodes_iterator nodes_end (const MachineFunction *F) {
526  return F->end();
527  }
528  static unsigned size (const MachineFunction *F) {
529  return F->size();
530  }
531 };
532 
533 
534 // Provide specializations of GraphTraits to be able to treat a function as a
535 // graph of basic blocks... and to walk it in inverse order. Inverse order for
536 // a function is considered to be when traversing the predecessor edges of a BB
537 // instead of the successor edges.
538 //
539 template <> struct GraphTraits<Inverse<MachineFunction*> > :
542  return &G.Graph->front();
543  }
544 };
545 template <> struct GraphTraits<Inverse<const MachineFunction*> > :
548  return &G.Graph->front();
549  }
550 };
551 
552 } // End llvm namespace
553 
554 #endif
void push_front(MachineBasicBlock *MBB)
Pass interface - Implemented by all 'passes'.
Definition: Pass.h:82
A parsed version of the target data layout string in and methods for querying it. ...
Definition: DataLayout.h:104
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
unsigned getAlignment() const
getAlignment - Return the alignment (log2, not bytes) of the function.
static NodeType * getEntryNode(Inverse< MachineFunction * > G)
MachineInstr * CreateMachineInstr(const MCInstrDesc &MCID, DebugLoc DL, bool NoImp=false)
CreateMachineInstr - Allocate a new MachineInstr.
void removeNodeFromList(NodeTy *)
Definition: ilist.h:116
iplist< MachineBasicBlock >::iterator iterator
Definition: ilist.h:588
void RenumberBlocks(MachineBasicBlock *MBBFrom=nullptr)
RenumberBlocks - This discards all of the MachineBasicBlock numbers and recomputes them...
static NodeTy * createNode(const NodeTy &V)
Definition: ilist.h:112
T * allocate(Capacity Cap, AllocatorType &Allocator)
Allocate an array of at least the requested capacity.
static void noteHead(MachineBasicBlock *, MachineBasicBlock *)
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:39
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
Definition: GraphTraits.h:27
std::reverse_iterator< iterator > reverse_iterator
reverse_iterator rend()
Definition: ilist.h:379
static nodes_iterator nodes_end(MachineFunction *F)
unsigned addLiveIn(unsigned PReg, const TargetRegisterClass *RC)
addLiveIn - Add the specified physical register as a live-in value and create a corresponding virtual...
Describe properties that are true of each instruction in the target description file.
Definition: MCInstrDesc.h:138
static NodeType * getEntryNode(Inverse< const MachineFunction * > G)
bool hasInlineAsm() const
Returns true if the function contains any inline assembly.
This file contains the declarations for metadata subclasses.
ArrayRecycler< MachineOperand >::Capacity OperandCapacity
void verify(Pass *p=nullptr, const char *Banner=nullptr) const
verify - Run the current MachineFunction through the machine code verifier, useful for debugger use...
A debug info location.
Definition: DebugLoc.h:34
Metadata node.
Definition: Metadata.h:740
F(f)
const Function * getFunction() const
getFunction - Return the LLVM function that this machine code represents
iterator begin()
Definition: ilist.h:359
unsigned getFunctionNumber() const
getFunctionNumber - Return a unique ID for the current function.
static nodes_iterator nodes_begin(const MachineFunction *F)
void DeleteMachineBasicBlock(MachineBasicBlock *MBB)
DeleteMachineBasicBlock - Delete the given MachineBasicBlock.
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, unsigned f, uint64_t s, unsigned base_alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr)
getMachineMemOperand - Allocate a new MachineMemOperand.
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
void destroySentinel(MachineBasicBlock *) const
MachineJumpTableInfo * getOrCreateJumpTableInfo(unsigned JTEntryKind)
getOrCreateJumpTableInfo - Get the JumpTableInfo for this function, if it does already exist...
reverse_iterator rbegin()
Definition: ilist.h:377
void viewCFG() const
viewCFG - This function is meant for use from the debugger.
static nodes_iterator nodes_begin(MachineFunction *F)
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
MachineMemOperand - A description of a memory reference used in the backend.
unsigned getNumBlockIDs() const
getNumBlockIDs - Return the number of MBB ID's allocated.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineJumpTableInfo * getJumpTableInfo()
const_reverse_iterator rend() const
void push_front(const NodeTy &val)
Definition: ilist.h:616
const STC & getSubtarget() const
getSubtarget - This method returns a pointer to the specified type of TargetSubtargetInfo.
MachineMemOperand ** mmo_iterator
Definition: MachineInstr.h:53
ilist_default_traits - Default template traits for intrusive list.
Definition: ilist.h:127
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
std::pair< MachineInstr::mmo_iterator, MachineInstr::mmo_iterator > extractLoadMemRefs(MachineInstr::mmo_iterator Begin, MachineInstr::mmo_iterator End)
extractLoadMemRefs - Allocate an array and populate it with just the load information from the given ...
#define G(x, y, z)
Definition: MD5.cpp:52
MachineBasicBlock * provideInitialHead() const
Context object for machine code objects.
Definition: MCContext.h:48
const MachineBasicBlock & front() const
SlotIndexes pass.
Definition: SlotIndexes.h:334
MachineBasicBlock * ensureHead(MachineBasicBlock *) const
const MachineJumpTableInfo * getJumpTableInfo() const
getJumpTableInfo - Return the jump table info object for the current function.
MachineFunction::const_iterator nodes_iterator
void print(raw_ostream &OS, SlotIndexes *=nullptr) const
print - Print out the MachineFunction in a format suitable for debugging to the specified stream...
MCContext & getContext() const
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
MachineBasicBlock * CreateMachineBasicBlock(const BasicBlock *bb=nullptr)
CreateMachineBasicBlock - Allocate a new MachineBasicBlock.
const MachineRegisterInfo & getRegInfo() const
static void deleteNode(NodeTy *V)
Definition: ilist.h:113
MachineBasicBlock * createSentinel() const
const MachineFrameInfo * getFrameInfo() const
LLVM Basic Block Representation.
Definition: BasicBlock.h:65
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:135
size_type LLVM_ATTRIBUTE_UNUSED_RESULT size() const
Definition: ilist.h:539
LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ATTRIBUTE_RETURNS_NOALIAS void * Allocate(size_t Size, size_t Alignment)
Allocate space at the specified alignment.
Definition: Allocator.h:208
bool shouldSplitStack()
Should we be emitting segmented stack stuff for the function.
void ensureAlignment(unsigned A)
ensureAlignment - Make sure the function is at least 1 << A bytes aligned.
void viewCFGOnly() const
viewCFGOnly - This function is meant for use from the debugger.
iterator insert(iterator where, const NodeTy &val)
Definition: ilist.h:610
void setSubtarget(const TargetSubtargetInfo *ST)
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
void setHasInlineAsm(bool B)
Set a flag that indicates that the function contains inline assembly.
void splice(iterator InsertPt, iterator MBBI, iterator MBBE)
MachineConstantPool * getConstantPool()
getConstantPool - Return the constant pool object for the current function.
static NodeType * getEntryNode(const MachineFunction *F)
unsigned size() const
void DeleteMachineInstr(MachineInstr *MI)
DeleteMachineInstr - Delete the given MachineInstr.
uint32_t * allocateRegisterMask(unsigned NumRegister)
Allocate and initialize a register mask with NumRegister bits.
MachineFunction::iterator nodes_iterator
aarch64 type AArch64 Type Promotion Pass
MachineBasicBlock & back()
MachinePointerInfo - This class contains a discriminated union of information about pointers in memor...
iterator erase(iterator where)
Definition: ilist.h:465
const GraphType & Graph
Definition: GraphTraits.h:79
MCSymbol * getPICBaseSymbol() const
getPICBaseSymbol - Return a function-local symbol to represent the PIC base.
Recycler - This class manages a linked-list of deallocated nodes and facilitates reusing deallocated ...
Definition: Recycler.h:66
BasicBlockListType::const_iterator const_iterator
void splice(iterator InsertPt, iterator MBBI)
MachineInstr * CloneMachineInstr(const MachineInstr *Orig)
CloneMachineInstr - Create a new MachineInstr which is a copy of the 'Orig' instruction, identical in all ways except the instruction has no parent, prev, or next.
MachineOperand class - Representation of each machine instruction operand.
MachineBasicBlock * getBlockNumbered(unsigned N) const
getBlockNumbered - MachineBasicBlocks are automatically numbered when they are inserted into the mach...
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
Definition: Metadata.h:548
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
Definition: ilist.h:385
const_iterator end() const
MachineFrameInfo * getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
reverse_iterator rend()
const MachineConstantPool * getConstantPool() const
void splice(iterator where, iplist &L2)
Definition: ilist.h:570
ilist_half_node< MachineBasicBlock > Sentinel
MCSymbol * getJTISymbol(unsigned JTI, MCContext &Ctx, bool isLinkerPrivate=false) const
getJTISymbol - Return the MCSymbol for the specified non-empty jump table.
Target - Wrapper for Target specific information.
void dump() const
dump - Print the current MachineFunction to cerr, useful for debugger use.
static unsigned size(MachineFunction *F)
reference front()
Definition: ilist.h:390
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
TargetSubtargetInfo - Generic base class for all target subtargets.
SI Fix SGPR Live Ranges
std::reverse_iterator< const_iterator > const_reverse_iterator
Representation of each machine instruction.
Definition: MachineInstr.h:51
static NodeType * getEntryNode(MachineFunction *F)
static Ty * create(BumpPtrAllocator &Allocator, MachineFunction &MF)
Factory function: default behavior is to call new using the supplied allocator.
static unsigned size(const MachineFunction *F)
void addNodeToList(NodeTy *)
Definition: ilist.h:115
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
bool exposesReturnsTwice() const
exposesReturnsTwice - Returns true if the function calls setjmp or any other similar functions with a...
#define N
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
MachineBasicBlock & front()
void setExposesReturnsTwice(bool B)
setCallsSetJmp - Set a flag that indicates if there's a call to a "returns twice" function...
void removeFromMBBNumbering(unsigned N)
removeFromMBBNumbering - Remove the specific machine basic block from our tracker, this is only really to be used by the MachineBasicBlock implementation.
reference back()
Definition: ilist.h:398
static NodeTy * createSentinel()
createSentinel - create the dynamic sentinel
Definition: ilist.h:78
const Ty * getInfo() const
std::pair< MachineInstr::mmo_iterator, MachineInstr::mmo_iterator > extractStoreMemRefs(MachineInstr::mmo_iterator Begin, MachineInstr::mmo_iterator End)
extractStoreMemRefs - Allocate an array and populate it with just the store information from the give...
void erase(iterator MBBI)
void insert(iterator MBBI, MachineBasicBlock *MBB)
static nodes_iterator nodes_end(const MachineFunction *F)
iterator end()
Definition: ilist.h:367
aarch64 promote const
unsigned addToMBBNumbering(MachineBasicBlock *MBB)
Adds the MBB to the internal numbering.
void deallocateOperandArray(OperandCapacity Cap, MachineOperand *Array)
Dellocate an array of MachineOperands and recycle the memory.
void push_back(MachineBasicBlock *MBB)
void setAlignment(unsigned A)
setAlignment - Set the alignment (log2, not bytes) of the function.
BasicBlockListType::iterator iterator
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:38
Primary interface to the complete machine description for the target machine.
const MachineBasicBlock & back() const
const_reverse_iterator rbegin() const
void deallocate(Capacity Cap, T *Ptr)
Deallocate an array with the specified Capacity.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:40
MachineModuleInfo & getMMI() const
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
const_iterator begin() const
reverse_iterator rbegin()
NodeTy * remove(iterator &IT)
Definition: ilist.h:435
MachineInstr::mmo_iterator allocateMemRefsArray(unsigned long Num)
allocateMemRefsArray - Allocate an array to hold MachineMemOperand pointers.
MachineOperand * allocateOperandArray(OperandCapacity Cap)
Allocate an array of MachineOperands.
void push_back(const NodeTy &val)
Definition: ilist.h:617
MachineModuleInfo - This class contains meta information specific to a module.