|
|
|||
File indexing completed on 2026-05-10 08:44:42
0001 //===- Transform/Utils/CodeMoverUtils.h - CodeMover Utils -------*- C++ -*-===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 // 0009 // This family of functions determine movements are safe on basic blocks, and 0010 // instructions contained within a function. 0011 // 0012 // Please note that this is work in progress, and the functionality is not 0013 // ready for broader production use. 0014 // 0015 //===----------------------------------------------------------------------===// 0016 0017 #ifndef LLVM_TRANSFORMS_UTILS_CODEMOVERUTILS_H 0018 #define LLVM_TRANSFORMS_UTILS_CODEMOVERUTILS_H 0019 0020 namespace llvm { 0021 0022 class BasicBlock; 0023 class DependenceInfo; 0024 class DominatorTree; 0025 class Instruction; 0026 class PostDominatorTree; 0027 0028 /// Return true if \p I0 and \p I1 are control flow equivalent. 0029 /// Two instructions are control flow equivalent if their basic blocks are 0030 /// control flow equivalent. 0031 bool isControlFlowEquivalent(const Instruction &I0, const Instruction &I1, 0032 const DominatorTree &DT, 0033 const PostDominatorTree &PDT); 0034 0035 /// Return true if \p BB0 and \p BB1 are control flow equivalent. 0036 /// Two basic blocks are control flow equivalent if when one executes, the other 0037 /// is guaranteed to execute. 0038 bool isControlFlowEquivalent(const BasicBlock &BB0, const BasicBlock &BB1, 0039 const DominatorTree &DT, 0040 const PostDominatorTree &PDT); 0041 0042 /// Return true if \p I can be safely moved before \p InsertPoint. 0043 bool isSafeToMoveBefore(Instruction &I, Instruction &InsertPoint, 0044 DominatorTree &DT, 0045 const PostDominatorTree *PDT = nullptr, 0046 DependenceInfo *DI = nullptr, 0047 bool CheckForEntireBlock = false); 0048 0049 /// Return true if all instructions (except the terminator) in \p BB can be 0050 /// safely moved before \p InsertPoint. 0051 bool isSafeToMoveBefore(BasicBlock &BB, Instruction &InsertPoint, 0052 DominatorTree &DT, 0053 const PostDominatorTree *PDT = nullptr, 0054 DependenceInfo *DI = nullptr); 0055 0056 /// Move instructions, in an order-preserving manner, from \p FromBB to the 0057 /// beginning of \p ToBB when proven safe. 0058 void moveInstructionsToTheBeginning(BasicBlock &FromBB, BasicBlock &ToBB, 0059 DominatorTree &DT, 0060 const PostDominatorTree &PDT, 0061 DependenceInfo &DI); 0062 0063 /// Move instructions, in an order-preserving manner, from \p FromBB to the end 0064 /// of \p ToBB when proven safe. 0065 void moveInstructionsToTheEnd(BasicBlock &FromBB, BasicBlock &ToBB, 0066 DominatorTree &DT, const PostDominatorTree &PDT, 0067 DependenceInfo &DI); 0068 0069 /// In case that two BBs \p ThisBlock and \p OtherBlock are control flow 0070 /// equivalent but they do not strictly dominate and post-dominate each 0071 /// other, we determine if \p ThisBlock is reached after \p OtherBlock 0072 /// in the control flow. 0073 bool nonStrictlyPostDominate(const BasicBlock *ThisBlock, 0074 const BasicBlock *OtherBlock, 0075 const DominatorTree *DT, 0076 const PostDominatorTree *PDT); 0077 0078 // Check if I0 is reached before I1 in the control flow. 0079 bool isReachedBefore(const Instruction *I0, const Instruction *I1, 0080 const DominatorTree *DT, const PostDominatorTree *PDT); 0081 0082 } // end namespace llvm 0083 0084 #endif // LLVM_TRANSFORMS_UTILS_CODEMOVERUTILS_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|