LLVM API Documentation
#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"

Go to the source code of this file.
Defines | |
| #define | DEBUG_TYPE "simplifycfg" |
Functions | |
| STATISTIC (NumSimpl,"Number of blocks simplified") | |
| FunctionPass * | llvm::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 DEBUG_TYPE "simplifycfg" |
Definition at line 24 of file SimplifyCFGPass.cpp.
| static void ChangeToCall | ( | InvokeInst * | II | ) | [static] |
ChangeToCall - Convert the specified invoke into a normal call.
Definition at line 79 of file SimplifyCFGPass.cpp.
References BB, llvm::BranchInst::Create(), llvm::CallInst::Create(), llvm::InvokeInst::getAttributes(), llvm::InvokeInst::getCalledValue(), llvm::InvokeInst::getCallingConv(), llvm::BasicBlock::getInstList(), llvm::InvokeInst::getNormalDest(), llvm::Instruction::getParent(), llvm::InvokeInst::getUnwindDest(), llvm::User::op_begin(), llvm::User::op_end(), llvm::BasicBlock::removePredecessor(), and llvm::Value::replaceAllUsesWith().
Referenced by MarkAliveBlocks().
| 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] |
Definition at line 97 of file SimplifyCFGPass.cpp.
References llvm::SmallVectorImpl< T >::back(), BBI, llvm::BasicBlock::begin(), Changed, ChangeToCall(), ChangeToUnreachable(), CI, llvm::ConstantFoldTerminator(), E, llvm::SmallVectorImpl< T >::empty(), llvm::BasicBlock::end(), llvm::BasicBlock::getTerminator(), II, llvm::SmallPtrSet< PtrType, SmallSize >::insert(), llvm::SmallVectorImpl< T >::pop_back(), llvm::SmallVectorImpl< T >::push_back(), SE, llvm::succ_begin(), llvm::succ_end(), and Worklist.
Referenced by RemoveUnreachableBlocksFromFn().
| 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" | ||||
| ) |
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.