LLVM  15.0.0git
Macros | Functions
CodeMoverUtils.cpp File Reference
#include "llvm/Transforms/Utils/CodeMoverUtils.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/DependenceAnalysis.h"
#include "llvm/Analysis/PostDominators.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/Dominators.h"
Include dependency graph for CodeMoverUtils.cpp:

Go to the source code of this file.


#define DEBUG_TYPE   "codemover-utils"


 STATISTIC (HasDependences, "Cannot move across instructions that has memory dependences")
 STATISTIC (MayThrowException, "Cannot move across instructions that may throw")
 STATISTIC (NotControlFlowEquivalent, "Instructions are not control flow equivalent")
 STATISTIC (NotMovedPHINode, "Movement of PHINodes are not supported")
 STATISTIC (NotMovedTerminator, "Movement of Terminator are not supported")
static bool domTreeLevelBefore (DominatorTree *DT, const Instruction *InstA, const Instruction *InstB)
static bool reportInvalidCandidate (const Instruction &I, llvm::Statistic &Stat)
static void collectInstructionsInBetween (Instruction &StartInst, const Instruction &EndInst, SmallPtrSetImpl< Instruction * > &InBetweenInsts)
 Collect all instructions in between StartInst and EndInst, and store them in InBetweenInsts. More...

Macro Definition Documentation


#define DEBUG_TYPE   "codemover-utils"

Definition at line 24 of file CodeMoverUtils.cpp.

Function Documentation

◆ collectInstructionsInBetween()

static void collectInstructionsInBetween ( Instruction StartInst,
const Instruction EndInst,
SmallPtrSetImpl< Instruction * > &  InBetweenInsts 

Collect all instructions in between StartInst and EndInst, and store them in InBetweenInsts.

Get the next instructions of I, and push them to WorkList.

Definition at line 278 of file CodeMoverUtils.cpp.

References assert(), llvm::SmallPtrSetImpl< PtrType >::begin(), llvm::SmallPtrSetImplBase::empty(), llvm::SmallPtrSetImpl< PtrType >::erase(), I, llvm::SmallPtrSetImpl< PtrType >::insert(), and llvm::successors().

Referenced by llvm::isSafeToMoveBefore().

◆ domTreeLevelBefore()

static bool domTreeLevelBefore ( DominatorTree DT,
const Instruction InstA,
const Instruction InstB 

◆ reportInvalidCandidate()

static bool reportInvalidCandidate ( const Instruction I,
llvm::Statistic Stat 

Definition at line 267 of file CodeMoverUtils.cpp.

References llvm::dbgs(), llvm::TrackingStatistic::getDesc(), I, and LLVM_DEBUG.

Referenced by llvm::isSafeToMoveBefore().

◆ STATISTIC() [1/5]

STATISTIC ( HasDependences  ,
"Cannot move across instructions that has memory dependences"   

◆ STATISTIC() [2/5]

STATISTIC ( MayThrowException  ,
"Cannot move across instructions that may throw"   

◆ STATISTIC() [3/5]

STATISTIC ( NotControlFlowEquivalent  ,
"Instructions are not control flow equivalent"   

◆ STATISTIC() [4/5]

STATISTIC ( NotMovedPHINode  ,
"Movement of PHINodes are not supported"   

◆ STATISTIC() [5/5]

STATISTIC ( NotMovedTerminator  ,
"Movement of Terminator are not supported"