From b915e9e0fc85ba6f398b3fab0db6a81a8913af94 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 2 Jan 2017 19:17:04 +0000 Subject: Vendor import of llvm trunk r290819: https://llvm.org/svn/llvm-project/llvm/trunk@290819 --- include/llvm/CodeGen/MachineLoopInfo.h | 38 ++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'include/llvm/CodeGen/MachineLoopInfo.h') diff --git a/include/llvm/CodeGen/MachineLoopInfo.h b/include/llvm/CodeGen/MachineLoopInfo.h index 224a2a1aa59f..dc72ae1810ee 100644 --- a/include/llvm/CodeGen/MachineLoopInfo.h +++ b/include/llvm/CodeGen/MachineLoopInfo.h @@ -54,6 +54,12 @@ public: /// that contains the header. MachineBasicBlock *getBottomBlock(); + /// \brief Find the block that contains the loop control variable and the + /// loop test. This will return the latch block if it's one of the exiting + /// blocks. Otherwise, return the exiting block. Return 'null' when + /// multiple exiting blocks are present. + MachineBasicBlock *findLoopControlBlock(); + void dump() const; private: @@ -81,6 +87,14 @@ public: LoopInfoBase& getBase() { return LI; } + /// \brief Find the block that either is the loop preheader, or could + /// speculatively be used as the preheader. This is e.g. useful to place + /// loop setup code. Code that cannot be speculated should not be placed + /// here. SpeculativePreheader is controlling whether it also tries to + /// find the speculative preheader if the regular preheader is not present. + MachineBasicBlock *findLoopPreheader(MachineLoop *L, + bool SpeculativePreheader = false) const; + /// The iterator interface to the top-level loops in the current function. typedef LoopInfoBase::iterator iterator; inline iterator begin() const { return LI.begin(); } @@ -148,29 +162,21 @@ public: // Allow clients to walk the list of nested loops... template <> struct GraphTraits { - typedef const MachineLoop NodeType; + typedef const MachineLoop *NodeRef; typedef MachineLoopInfo::iterator ChildIteratorType; - static NodeType *getEntryNode(const MachineLoop *L) { return L; } - static inline ChildIteratorType child_begin(NodeType *N) { - return N->begin(); - } - static inline ChildIteratorType child_end(NodeType *N) { - return N->end(); - } + static NodeRef getEntryNode(const MachineLoop *L) { return L; } + static ChildIteratorType child_begin(NodeRef N) { return N->begin(); } + static ChildIteratorType child_end(NodeRef N) { return N->end(); } }; template <> struct GraphTraits { - typedef MachineLoop NodeType; + typedef MachineLoop *NodeRef; typedef MachineLoopInfo::iterator ChildIteratorType; - static NodeType *getEntryNode(MachineLoop *L) { return L; } - static inline ChildIteratorType child_begin(NodeType *N) { - return N->begin(); - } - static inline ChildIteratorType child_end(NodeType *N) { - return N->end(); - } + static NodeRef getEntryNode(MachineLoop *L) { return L; } + static ChildIteratorType child_begin(NodeRef N) { return N->begin(); } + static ChildIteratorType child_end(NodeRef N) { return N->end(); } }; } // End llvm namespace -- cgit v1.3