LLVM API Documentation

SimplifyCFGPass.cpp File Reference

#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Constants.h"
#include "llvm/Instructions.h"
#include "llvm/Module.h"
#include "llvm/Attributes.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Pass.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/Statistic.h"

Include dependency graph for SimplifyCFGPass.cpp:

Go to the source code of this file.

Defines

#define DEBUG_TYPE   "simplifycfg"

Functions

 STATISTIC (NumSimpl,"Number of blocks simplified")
FunctionPassllvm::createCFGSimplificationPass ()
static void ChangeToUnreachable (Instruction *I)
static void ChangeToCall (InvokeInst *II)
 ChangeToCall - Convert the specified invoke into a normal call.
static bool MarkAliveBlocks (BasicBlock *BB, SmallPtrSet< BasicBlock *, 128 > &Reachable)
static bool RemoveUnreachableBlocksFromFn (Function &F)
static bool IterativeSimplifyCFG (Function &F)

Variables

static RegisterPass
< CFGSimplifyPass > 
X ("simplifycfg","Simplify the CFG")


Define Documentation

#define DEBUG_TYPE   "simplifycfg"

Definition at line 24 of file SimplifyCFGPass.cpp.


Function Documentation

static void ChangeToCall ( InvokeInst II  )  [static]

static void ChangeToUnreachable ( Instruction I  )  [static]

ChangeToUnreachable - Insert an unreachable instruction before the specified instruction, making it and the rest of the code in the block dead.

Definition at line 60 of file SimplifyCFGPass.cpp.

References BB, BBI, llvm::BasicBlock::end(), llvm::UndefValue::get(), llvm::BasicBlock::getInstList(), llvm::Instruction::getParent(), llvm::BasicBlock::removePredecessor(), SE, llvm::succ_begin(), and llvm::succ_end().

Referenced by MarkAliveBlocks().

static bool IterativeSimplifyCFG ( Function F  )  [static]

IterativeSimplifyCFG - Call SimplifyCFG on all the blocks in the function, iterating until no more changes are made.

Definition at line 188 of file SimplifyCFGPass.cpp.

References llvm::Function::begin(), Changed, llvm::Function::end(), and llvm::SimplifyCFG().

static bool MarkAliveBlocks ( BasicBlock BB,
SmallPtrSet< BasicBlock *, 128 > &  Reachable 
) [static]

static bool RemoveUnreachableBlocksFromFn ( Function F  )  [static]

RemoveUnreachableBlocksFromFn - Remove blocks that are not reachable, even if they are in a dead cycle. Return true if a change was made, false otherwise.

Definition at line 154 of file SimplifyCFGPass.cpp.

References BB, llvm::Function::begin(), Changed, llvm::SmallPtrSet< PtrType, SmallSize >::count(), E, llvm::Function::end(), llvm::Function::getBasicBlockList(), I, MarkAliveBlocks(), SE, llvm::Function::size(), llvm::SmallPtrSetImpl::size(), llvm::succ_begin(), and llvm::succ_end().

STATISTIC ( NumSimpl  ,
"Number of blocks simplified"   
)


Variable Documentation

char ID [static]

Definition at line 43 of file SimplifyCFGPass.cpp.

RegisterPass<CFGSimplifyPass> X("simplifycfg","Simplify the CFG") [static]




This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.