1 //===-- llvm/CodeGen/MachineFunction.h --------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Collect native machine code for a function. This class contains a list of
11 // MachineBasicBlock instances that make up the current compiled function.
13 // This class also contains pointers to various classes which hold
14 // target-specific information about the generated code.
16 //===----------------------------------------------------------------------===//
18 #ifndef LLVM_CODEGEN_MACHINEFUNCTION_H
19 #define LLVM_CODEGEN_MACHINEFUNCTION_H
21 #include "llvm/ADT/BitVector.h"
22 #include "llvm/ADT/ilist.h"
23 #include "llvm/CodeGen/MachineBasicBlock.h"
24 #include "llvm/CodeGen/MachineMemOperand.h"
25 #include "llvm/IR/DebugLoc.h"
26 #include "llvm/IR/Metadata.h"
27 #include "llvm/Support/Allocator.h"
28 #include "llvm/Support/ArrayRecycler.h"
29 #include "llvm/Support/Compiler.h"
30 #include "llvm/Support/Recycler.h"
37 class MachineRegisterInfo;
38 class MachineFrameInfo;
39 class MachineConstantPool;
40 class MachineJumpTableInfo;
41 class MachineModuleInfo;
44 class PseudoSourceValueManager;
46 class TargetSubtargetInfo;
47 class TargetRegisterClass;
48 struct MachinePointerInfo;
52 struct ilist_traits<MachineBasicBlock>
53 : public ilist_default_traits<MachineBasicBlock> {
54 mutable ilist_half_node<MachineBasicBlock> Sentinel;
56 // FIXME: This downcast is UB. See llvm.org/PR26753.
57 LLVM_NO_SANITIZE("object-size")
58 MachineBasicBlock *createSentinel() const {
59 return static_cast<MachineBasicBlock*>(&Sentinel);
61 void destroySentinel(MachineBasicBlock *) const {}
63 MachineBasicBlock *provideInitialHead() const { return createSentinel(); }
64 MachineBasicBlock *ensureHead(MachineBasicBlock*) const {
65 return createSentinel();
67 static void noteHead(MachineBasicBlock*, MachineBasicBlock*) {}
69 void addNodeToList(MachineBasicBlock* MBB);
70 void removeNodeFromList(MachineBasicBlock* MBB);
71 void deleteNode(MachineBasicBlock *MBB);
73 void createNode(const MachineBasicBlock &);
76 /// MachineFunctionInfo - This class can be derived from and used by targets to
77 /// hold private target-specific information for each MachineFunction. Objects
78 /// of type are accessed/created with MF::getInfo and destroyed when the
79 /// MachineFunction is destroyed.
80 struct MachineFunctionInfo {
81 virtual ~MachineFunctionInfo();
83 /// \brief Factory function: default behavior is to call new using the
84 /// supplied allocator.
86 /// This function can be overridden in a derive class.
88 static Ty *create(BumpPtrAllocator &Allocator, MachineFunction &MF) {
89 return new (Allocator.Allocate<Ty>()) Ty(MF);
93 /// Properties which a MachineFunction may have at a given point in time.
94 /// Each of these has checking code in the MachineVerifier, and passes can
95 /// require that a property be set.
96 class MachineFunctionProperties {
97 // TODO: Add MachineVerifier checks for AllVRegsAllocated
98 // TODO: Add a way to print the properties and make more useful error messages
99 // Possible TODO: Allow targets to extend this (perhaps by allowing the
100 // constructor to specify the size of the bit vector)
101 // Possible TODO: Allow requiring the negative (e.g. VRegsAllocated could be
102 // stated as the negative of "has vregs"
105 // The properties are stated in "positive" form; i.e. a pass could require
106 // that the property hold, but not that it does not hold.
108 // Property descriptions:
109 // IsSSA: True when the machine function is in SSA form and virtual registers
110 // have a single def.
111 // TracksLiveness: True when tracking register liveness accurately.
112 // While this property is set, register liveness information in basic block
113 // live-in lists and machine instruction operands (e.g. kill flags, implicit
114 // defs) is accurate. This means it can be used to change the code in ways
115 // that affect the values in registers, for example by the register
117 // When this property is clear, liveness is no longer reliable.
118 // AllVRegsAllocated: All virtual registers have been allocated; i.e. all
119 // register operands are physical registers.
120 enum class Property : unsigned {
127 bool hasProperty(Property P) const {
128 return Properties[static_cast<unsigned>(P)];
130 MachineFunctionProperties &set(Property P) {
131 Properties.set(static_cast<unsigned>(P));
134 MachineFunctionProperties &clear(Property P) {
135 Properties.reset(static_cast<unsigned>(P));
138 MachineFunctionProperties &set(const MachineFunctionProperties &MFP) {
139 Properties |= MFP.Properties;
142 MachineFunctionProperties &clear(const MachineFunctionProperties &MFP) {
143 Properties.reset(MFP.Properties);
146 // Returns true if all properties set in V (i.e. required by a pass) are set
148 bool verifyRequiredProperties(const MachineFunctionProperties &V) const {
149 return !V.Properties.test(Properties);
152 // Print the MachineFunctionProperties in human-readable form. If OnlySet is
153 // true, only print the properties that are set.
154 void print(raw_ostream &ROS, bool OnlySet=false) const;
157 BitVector Properties =
158 BitVector(static_cast<unsigned>(Property::LastProperty));
161 class MachineFunction {
163 const TargetMachine &Target;
164 const TargetSubtargetInfo *STI;
166 MachineModuleInfo &MMI;
168 // RegInfo - Information about each register in use in the function.
169 MachineRegisterInfo *RegInfo;
171 // Used to keep track of target-specific per-machine function information for
172 // the target implementation.
173 MachineFunctionInfo *MFInfo;
175 // Keep track of objects allocated on the stack.
176 MachineFrameInfo *FrameInfo;
178 // Keep track of constants which are spilled to memory
179 MachineConstantPool *ConstantPool;
181 // Keep track of jump tables for switch instructions
182 MachineJumpTableInfo *JumpTableInfo;
184 // Keeps track of Windows exception handling related data. This will be null
185 // for functions that aren't using a funclet-based EH personality.
186 WinEHFuncInfo *WinEHInfo = nullptr;
188 // Function-level unique numbering for MachineBasicBlocks. When a
189 // MachineBasicBlock is inserted into a MachineFunction is it automatically
190 // numbered and this vector keeps track of the mapping from ID's to MBB's.
191 std::vector<MachineBasicBlock*> MBBNumbering;
193 // Pool-allocate MachineFunction-lifetime and IR objects.
194 BumpPtrAllocator Allocator;
196 // Allocation management for instructions in function.
197 Recycler<MachineInstr> InstructionRecycler;
199 // Allocation management for operand arrays on instructions.
200 ArrayRecycler<MachineOperand> OperandRecycler;
202 // Allocation management for basic blocks in function.
203 Recycler<MachineBasicBlock> BasicBlockRecycler;
205 // List of machine basic blocks in function
206 typedef ilist<MachineBasicBlock> BasicBlockListType;
207 BasicBlockListType BasicBlocks;
209 /// FunctionNumber - This provides a unique ID for each function emitted in
210 /// this translation unit.
212 unsigned FunctionNumber;
214 /// Alignment - The alignment of the function.
217 /// ExposesReturnsTwice - True if the function calls setjmp or related
218 /// functions with attribute "returns twice", but doesn't have
219 /// the attribute itself.
220 /// This is used to limit optimizations which cannot reason
221 /// about the control flow of such functions.
222 bool ExposesReturnsTwice = false;
224 /// True if the function includes any inline assembly.
225 bool HasInlineAsm = false;
227 /// Current high-level properties of the IR of the function (e.g. is in SSA
228 /// form or whether registers have been allocated)
229 MachineFunctionProperties Properties;
231 // Allocation management for pseudo source values.
232 std::unique_ptr<PseudoSourceValueManager> PSVManager;
234 MachineFunction(const MachineFunction &) = delete;
235 void operator=(const MachineFunction&) = delete;
237 MachineFunction(const Function *Fn, const TargetMachine &TM,
238 unsigned FunctionNum, MachineModuleInfo &MMI);
241 MachineModuleInfo &getMMI() const { return MMI; }
242 MCContext &getContext() const { return Ctx; }
244 PseudoSourceValueManager &getPSVManager() const { return *PSVManager; }
246 /// Return the DataLayout attached to the Module associated to this MF.
247 const DataLayout &getDataLayout() const;
249 /// getFunction - Return the LLVM function that this machine code represents
251 const Function *getFunction() const { return Fn; }
253 /// getName - Return the name of the corresponding LLVM function.
255 StringRef getName() const;
257 /// getFunctionNumber - Return a unique ID for the current function.
259 unsigned getFunctionNumber() const { return FunctionNumber; }
261 /// getTarget - Return the target machine this machine code is compiled with
263 const TargetMachine &getTarget() const { return Target; }
265 /// getSubtarget - Return the subtarget for which this machine code is being
267 const TargetSubtargetInfo &getSubtarget() const { return *STI; }
268 void setSubtarget(const TargetSubtargetInfo *ST) { STI = ST; }
270 /// getSubtarget - This method returns a pointer to the specified type of
271 /// TargetSubtargetInfo. In debug builds, it verifies that the object being
272 /// returned is of the correct type.
273 template<typename STC> const STC &getSubtarget() const {
274 return *static_cast<const STC *>(STI);
277 /// getRegInfo - Return information about the registers currently in use.
279 MachineRegisterInfo &getRegInfo() { return *RegInfo; }
280 const MachineRegisterInfo &getRegInfo() const { return *RegInfo; }
282 /// getFrameInfo - Return the frame info object for the current function.
283 /// This object contains information about objects allocated on the stack
284 /// frame of the current function in an abstract way.
286 MachineFrameInfo *getFrameInfo() { return FrameInfo; }
287 const MachineFrameInfo *getFrameInfo() const { return FrameInfo; }
289 /// getJumpTableInfo - Return the jump table info object for the current
290 /// function. This object contains information about jump tables in the
291 /// current function. If the current function has no jump tables, this will
293 const MachineJumpTableInfo *getJumpTableInfo() const { return JumpTableInfo; }
294 MachineJumpTableInfo *getJumpTableInfo() { return JumpTableInfo; }
296 /// getOrCreateJumpTableInfo - Get the JumpTableInfo for this function, if it
297 /// does already exist, allocate one.
298 MachineJumpTableInfo *getOrCreateJumpTableInfo(unsigned JTEntryKind);
300 /// getConstantPool - Return the constant pool object for the current
303 MachineConstantPool *getConstantPool() { return ConstantPool; }
304 const MachineConstantPool *getConstantPool() const { return ConstantPool; }
306 /// getWinEHFuncInfo - Return information about how the current function uses
307 /// Windows exception handling. Returns null for functions that don't use
308 /// funclets for exception handling.
309 const WinEHFuncInfo *getWinEHFuncInfo() const { return WinEHInfo; }
310 WinEHFuncInfo *getWinEHFuncInfo() { return WinEHInfo; }
312 /// getAlignment - Return the alignment (log2, not bytes) of the function.
314 unsigned getAlignment() const { return Alignment; }
316 /// setAlignment - Set the alignment (log2, not bytes) of the function.
318 void setAlignment(unsigned A) { Alignment = A; }
320 /// ensureAlignment - Make sure the function is at least 1 << A bytes aligned.
321 void ensureAlignment(unsigned A) {
322 if (Alignment < A) Alignment = A;
325 /// exposesReturnsTwice - Returns true if the function calls setjmp or
326 /// any other similar functions with attribute "returns twice" without
327 /// having the attribute itself.
328 bool exposesReturnsTwice() const {
329 return ExposesReturnsTwice;
332 /// setCallsSetJmp - Set a flag that indicates if there's a call to
333 /// a "returns twice" function.
334 void setExposesReturnsTwice(bool B) {
335 ExposesReturnsTwice = B;
338 /// Returns true if the function contains any inline assembly.
339 bool hasInlineAsm() const {
343 /// Set a flag that indicates that the function contains inline assembly.
344 void setHasInlineAsm(bool B) {
348 /// Get the function properties
349 const MachineFunctionProperties &getProperties() const { return Properties; }
350 MachineFunctionProperties &getProperties() { return Properties; }
352 /// getInfo - Keep track of various per-function pieces of information for
353 /// backends that would like to do so.
355 template<typename Ty>
358 MFInfo = Ty::template create<Ty>(Allocator, *this);
359 return static_cast<Ty*>(MFInfo);
362 template<typename Ty>
363 const Ty *getInfo() const {
364 return const_cast<MachineFunction*>(this)->getInfo<Ty>();
367 /// getBlockNumbered - MachineBasicBlocks are automatically numbered when they
368 /// are inserted into the machine function. The block number for a machine
369 /// basic block can be found by using the MBB::getBlockNumber method, this
370 /// method provides the inverse mapping.
372 MachineBasicBlock *getBlockNumbered(unsigned N) const {
373 assert(N < MBBNumbering.size() && "Illegal block number");
374 assert(MBBNumbering[N] && "Block was removed from the machine function!");
375 return MBBNumbering[N];
378 /// Should we be emitting segmented stack stuff for the function
379 bool shouldSplitStack() const;
381 /// getNumBlockIDs - Return the number of MBB ID's allocated.
383 unsigned getNumBlockIDs() const { return (unsigned)MBBNumbering.size(); }
385 /// RenumberBlocks - This discards all of the MachineBasicBlock numbers and
386 /// recomputes them. This guarantees that the MBB numbers are sequential,
387 /// dense, and match the ordering of the blocks within the function. If a
388 /// specific MachineBasicBlock is specified, only that block and those after
389 /// it are renumbered.
390 void RenumberBlocks(MachineBasicBlock *MBBFrom = nullptr);
392 /// print - Print out the MachineFunction in a format suitable for debugging
393 /// to the specified stream.
395 void print(raw_ostream &OS, const SlotIndexes* = nullptr) const;
397 /// viewCFG - This function is meant for use from the debugger. You can just
398 /// say 'call F->viewCFG()' and a ghostview window should pop up from the
399 /// program, displaying the CFG of the current function with the code for each
400 /// basic block inside. This depends on there being a 'dot' and 'gv' program
403 void viewCFG() const;
405 /// viewCFGOnly - This function is meant for use from the debugger. It works
406 /// just like viewCFG, but it does not include the contents of basic blocks
407 /// into the nodes, just the label. If you are only interested in the CFG
408 /// this can make the graph smaller.
410 void viewCFGOnly() const;
412 /// dump - Print the current MachineFunction to cerr, useful for debugger use.
416 /// Run the current MachineFunction through the machine code verifier, useful
417 /// for debugger use.
418 /// \returns true if no problems were found.
419 bool verify(Pass *p = nullptr, const char *Banner = nullptr,
420 bool AbortOnError = true) const;
422 // Provide accessors for the MachineBasicBlock list...
423 typedef BasicBlockListType::iterator iterator;
424 typedef BasicBlockListType::const_iterator const_iterator;
425 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
426 typedef std::reverse_iterator<iterator> reverse_iterator;
428 /// Support for MachineBasicBlock::getNextNode().
429 static BasicBlockListType MachineFunction::*
430 getSublistAccess(MachineBasicBlock *) {
431 return &MachineFunction::BasicBlocks;
434 /// addLiveIn - Add the specified physical register as a live-in value and
435 /// create a corresponding virtual register for it.
436 unsigned addLiveIn(unsigned PReg, const TargetRegisterClass *RC);
438 //===--------------------------------------------------------------------===//
439 // BasicBlock accessor functions.
441 iterator begin() { return BasicBlocks.begin(); }
442 const_iterator begin() const { return BasicBlocks.begin(); }
443 iterator end () { return BasicBlocks.end(); }
444 const_iterator end () const { return BasicBlocks.end(); }
446 reverse_iterator rbegin() { return BasicBlocks.rbegin(); }
447 const_reverse_iterator rbegin() const { return BasicBlocks.rbegin(); }
448 reverse_iterator rend () { return BasicBlocks.rend(); }
449 const_reverse_iterator rend () const { return BasicBlocks.rend(); }
451 unsigned size() const { return (unsigned)BasicBlocks.size();}
452 bool empty() const { return BasicBlocks.empty(); }
453 const MachineBasicBlock &front() const { return BasicBlocks.front(); }
454 MachineBasicBlock &front() { return BasicBlocks.front(); }
455 const MachineBasicBlock & back() const { return BasicBlocks.back(); }
456 MachineBasicBlock & back() { return BasicBlocks.back(); }
458 void push_back (MachineBasicBlock *MBB) { BasicBlocks.push_back (MBB); }
459 void push_front(MachineBasicBlock *MBB) { BasicBlocks.push_front(MBB); }
460 void insert(iterator MBBI, MachineBasicBlock *MBB) {
461 BasicBlocks.insert(MBBI, MBB);
463 void splice(iterator InsertPt, iterator MBBI) {
464 BasicBlocks.splice(InsertPt, BasicBlocks, MBBI);
466 void splice(iterator InsertPt, MachineBasicBlock *MBB) {
467 BasicBlocks.splice(InsertPt, BasicBlocks, MBB);
469 void splice(iterator InsertPt, iterator MBBI, iterator MBBE) {
470 BasicBlocks.splice(InsertPt, BasicBlocks, MBBI, MBBE);
473 void remove(iterator MBBI) { BasicBlocks.remove(MBBI); }
474 void remove(MachineBasicBlock *MBBI) { BasicBlocks.remove(MBBI); }
475 void erase(iterator MBBI) { BasicBlocks.erase(MBBI); }
476 void erase(MachineBasicBlock *MBBI) { BasicBlocks.erase(MBBI); }
478 template <typename Comp>
479 void sort(Comp comp) {
480 BasicBlocks.sort(comp);
483 //===--------------------------------------------------------------------===//
484 // Internal functions used to automatically number MachineBasicBlocks
487 /// \brief Adds the MBB to the internal numbering. Returns the unique number
488 /// assigned to the MBB.
490 unsigned addToMBBNumbering(MachineBasicBlock *MBB) {
491 MBBNumbering.push_back(MBB);
492 return (unsigned)MBBNumbering.size()-1;
495 /// removeFromMBBNumbering - Remove the specific machine basic block from our
496 /// tracker, this is only really to be used by the MachineBasicBlock
498 void removeFromMBBNumbering(unsigned N) {
499 assert(N < MBBNumbering.size() && "Illegal basic block #");
500 MBBNumbering[N] = nullptr;
503 /// CreateMachineInstr - Allocate a new MachineInstr. Use this instead
504 /// of `new MachineInstr'.
506 MachineInstr *CreateMachineInstr(const MCInstrDesc &MCID, const DebugLoc &DL,
509 /// CloneMachineInstr - Create a new MachineInstr which is a copy of the
510 /// 'Orig' instruction, identical in all ways except the instruction
511 /// has no parent, prev, or next.
513 /// See also TargetInstrInfo::duplicate() for target-specific fixes to cloned
515 MachineInstr *CloneMachineInstr(const MachineInstr *Orig);
517 /// DeleteMachineInstr - Delete the given MachineInstr.
519 void DeleteMachineInstr(MachineInstr *MI);
521 /// CreateMachineBasicBlock - Allocate a new MachineBasicBlock. Use this
522 /// instead of `new MachineBasicBlock'.
524 MachineBasicBlock *CreateMachineBasicBlock(const BasicBlock *bb = nullptr);
526 /// DeleteMachineBasicBlock - Delete the given MachineBasicBlock.
528 void DeleteMachineBasicBlock(MachineBasicBlock *MBB);
530 /// getMachineMemOperand - Allocate a new MachineMemOperand.
531 /// MachineMemOperands are owned by the MachineFunction and need not be
532 /// explicitly deallocated.
533 MachineMemOperand *getMachineMemOperand(MachinePointerInfo PtrInfo,
534 MachineMemOperand::Flags f,
535 uint64_t s, unsigned base_alignment,
536 const AAMDNodes &AAInfo = AAMDNodes(),
537 const MDNode *Ranges = nullptr);
539 /// getMachineMemOperand - Allocate a new MachineMemOperand by copying
540 /// an existing one, adjusting by an offset and using the given size.
541 /// MachineMemOperands are owned by the MachineFunction and need not be
542 /// explicitly deallocated.
543 MachineMemOperand *getMachineMemOperand(const MachineMemOperand *MMO,
544 int64_t Offset, uint64_t Size);
546 typedef ArrayRecycler<MachineOperand>::Capacity OperandCapacity;
548 /// Allocate an array of MachineOperands. This is only intended for use by
549 /// internal MachineInstr functions.
550 MachineOperand *allocateOperandArray(OperandCapacity Cap) {
551 return OperandRecycler.allocate(Cap, Allocator);
554 /// Dellocate an array of MachineOperands and recycle the memory. This is
555 /// only intended for use by internal MachineInstr functions.
556 /// Cap must be the same capacity that was used to allocate the array.
557 void deallocateOperandArray(OperandCapacity Cap, MachineOperand *Array) {
558 OperandRecycler.deallocate(Cap, Array);
561 /// \brief Allocate and initialize a register mask with @p NumRegister bits.
562 uint32_t *allocateRegisterMask(unsigned NumRegister) {
563 unsigned Size = (NumRegister + 31) / 32;
564 uint32_t *Mask = Allocator.Allocate<uint32_t>(Size);
565 for (unsigned i = 0; i != Size; ++i)
570 /// allocateMemRefsArray - Allocate an array to hold MachineMemOperand
571 /// pointers. This array is owned by the MachineFunction.
572 MachineInstr::mmo_iterator allocateMemRefsArray(unsigned long Num);
574 /// extractLoadMemRefs - Allocate an array and populate it with just the
575 /// load information from the given MachineMemOperand sequence.
576 std::pair<MachineInstr::mmo_iterator,
577 MachineInstr::mmo_iterator>
578 extractLoadMemRefs(MachineInstr::mmo_iterator Begin,
579 MachineInstr::mmo_iterator End);
581 /// extractStoreMemRefs - Allocate an array and populate it with just the
582 /// store information from the given MachineMemOperand sequence.
583 std::pair<MachineInstr::mmo_iterator,
584 MachineInstr::mmo_iterator>
585 extractStoreMemRefs(MachineInstr::mmo_iterator Begin,
586 MachineInstr::mmo_iterator End);
588 /// Allocate a string and populate it with the given external symbol name.
589 const char *createExternalSymbolName(StringRef Name);
591 //===--------------------------------------------------------------------===//
592 // Label Manipulation.
595 /// getJTISymbol - Return the MCSymbol for the specified non-empty jump table.
596 /// If isLinkerPrivate is specified, an 'l' label is returned, otherwise a
597 /// normal 'L' label is returned.
598 MCSymbol *getJTISymbol(unsigned JTI, MCContext &Ctx,
599 bool isLinkerPrivate = false) const;
601 /// getPICBaseSymbol - Return a function-local symbol to represent the PIC
603 MCSymbol *getPICBaseSymbol() const;
606 //===--------------------------------------------------------------------===//
607 // GraphTraits specializations for function basic block graphs (CFGs)
608 //===--------------------------------------------------------------------===//
610 // Provide specializations of GraphTraits to be able to treat a
611 // machine function as a graph of machine basic blocks... these are
612 // the same as the machine basic block iterators, except that the root
613 // node is implicitly the first node of the function.
615 template <> struct GraphTraits<MachineFunction*> :
616 public GraphTraits<MachineBasicBlock*> {
617 static NodeType *getEntryNode(MachineFunction *F) {
621 // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
622 typedef MachineFunction::iterator nodes_iterator;
623 static nodes_iterator nodes_begin(MachineFunction *F) { return F->begin(); }
624 static nodes_iterator nodes_end (MachineFunction *F) { return F->end(); }
625 static unsigned size (MachineFunction *F) { return F->size(); }
627 template <> struct GraphTraits<const MachineFunction*> :
628 public GraphTraits<const MachineBasicBlock*> {
629 static NodeType *getEntryNode(const MachineFunction *F) {
633 // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
634 typedef MachineFunction::const_iterator nodes_iterator;
635 static nodes_iterator nodes_begin(const MachineFunction *F) {
638 static nodes_iterator nodes_end (const MachineFunction *F) {
641 static unsigned size (const MachineFunction *F) {
647 // Provide specializations of GraphTraits to be able to treat a function as a
648 // graph of basic blocks... and to walk it in inverse order. Inverse order for
649 // a function is considered to be when traversing the predecessor edges of a BB
650 // instead of the successor edges.
652 template <> struct GraphTraits<Inverse<MachineFunction*> > :
653 public GraphTraits<Inverse<MachineBasicBlock*> > {
654 static NodeType *getEntryNode(Inverse<MachineFunction*> G) {
655 return &G.Graph->front();
658 template <> struct GraphTraits<Inverse<const MachineFunction*> > :
659 public GraphTraits<Inverse<const MachineBasicBlock*> > {
660 static NodeType *getEntryNode(Inverse<const MachineFunction *> G) {
661 return &G.Graph->front();
665 } // End llvm namespace