LLVM API Documentation
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Constants.h"
#include "llvm/Instructions.h"
#include "llvm/Type.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/Debug.h"
#include <algorithm>
#include <functional>
#include <set>
#include <map>
Include dependency graph for Utils/SimplifyCFG.cpp:
Go to the source code of this file.
|
Definition at line 14 of file Utils/SimplifyCFG.cpp. |
|
AddPredecessorToBlock - Update PHI nodes in Succ to indicate that there will now be entries in it from the 'NewPred' block. The values that will be flowing into the PHI nodes will be the same as those coming in from ExistPred, an existing predecessor of Succ. Definition at line 365 of file Utils/SimplifyCFG.cpp. References llvm::PHINode::addIncoming(), llvm::BasicBlock::begin(), llvm::PHINode::getIncomingValueForBlock(), I, llvm::succ_begin(), llvm::succ_end(), and V. Referenced by FoldValueComparisonIntoPredecessors(), HoistThenElseCodeToIf(), and llvm::SimplifyCFG(). |
|
Definition at line 193 of file Utils/SimplifyCFG.cpp. References Add(), llvm::ISD::And, llvm::BasicBlock::begin(), llvm::User::getNumOperands(), llvm::Instruction::getOpcode(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::BasicBlock::getTerminator(), I, llvm::ISD::Load, llvm::ISD::Or, llvm::Instruction::Shl, and llvm::ISD::Xor. Referenced by llvm::SimplifyCFG(). |
|
ErasePossiblyDeadInstructionTree - If the specified instruction is dead and has no side effects, nuke it. If it uses any instructions that become dead because the instruction is now gone, nuke them too. Definition at line 325 of file Utils/SimplifyCFG.cpp. References llvm::BasicBlock::getInstList(), llvm::Instruction::getParent(), llvm::isInstructionTriviallyDead(), llvm::User::op_begin(), and llvm::User::op_end(). Referenced by llvm::SimplifyCFG(). |
|
|
Definition at line 253 of file Utils/SimplifyCFG.cpp. References C, llvm::ISD::Or, and llvm::ISD::SetEQ. Referenced by GatherValueComparisons(). |
|
Definition at line 275 of file Utils/SimplifyCFG.cpp. References llvm::ISD::And, llvm::Type::BoolTy, C, llvm::Instruction::Cast, llvm::ConstantInt::get(), and llvm::ISD::SetNE. Referenced by GatherValueComparisons(). |
|
GatherValueComparisons - If the specified Cond is an 'and' or 'or' of a bunch of comparisons of one value against constants, return the value and the constants being compared. Definition at line 304 of file Utils/SimplifyCFG.cpp. References llvm::ISD::And, GatherConstantSetEQs(), GatherConstantSetNEs(), llvm::Instruction::getOpcode(), and llvm::ISD::Or. Referenced by llvm::SimplifyCFG(). |
|
GetIfCondition - Given a basic block (BB) with two predecessors (and presumably PHI nodes in it), check to see if the merge at this block is due to an "if condition". If so, return the boolean condition that determines which entry into BB will be taken. Also, return by references the block that will be entered from if the condition is true, and the block that will be entered if the condition is false. Definition at line 102 of file Utils/SimplifyCFG.cpp. References llvm::BranchInst::getCondition(), llvm::BranchInst::getSuccessor(), llvm::BasicBlock::getTerminator(), llvm::BranchInst::isConditional(), llvm::pred_begin(), and llvm::pred_end(). Referenced by llvm::SimplifyCFG(). |
|
Definition at line 403 of file Utils/SimplifyCFG.cpp. References llvm::BranchInst::getCondition(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::BranchInst::getSuccessor(), llvm::ISD::SetEQ, and llvm::ISD::SetNE. Referenced by FoldValueComparisonIntoPredecessors(). |
|
HoistThenElseCodeToIf - Given a conditional branch that codes to BB1 and BB2, hoist any common code in the two blocks up into the branch block. The caller of this function guarantees that BI's block dominates BB1 and BB2. Definition at line 550 of file Utils/SimplifyCFG.cpp. References AddPredecessorToBlock(), llvm::BasicBlock::begin(), llvm::Instruction::clone(), E, llvm::Instruction::eraseFromParent(), llvm::BranchInst::getCondition(), llvm::PHINode::getIncomingBlock(), llvm::PHINode::getIncomingValueForBlock(), llvm::BasicBlock::getInstList(), llvm::Value::getName(), llvm::PHINode::getNumIncomingValues(), llvm::Instruction::getOpcode(), llvm::Instruction::getParent(), llvm::BranchInst::getSuccessor(), llvm::Value::getType(), llvm::Instruction::isIdenticalTo(), llvm::Value::replaceAllUsesWith(), llvm::PHINode::setIncomingValue(), llvm::Instruction::setName(), llvm::succ_begin(), llvm::succ_end(), and llvm::Type::VoidTy. Referenced by llvm::SimplifyCFG(). |
|
Definition at line 380 of file Utils/SimplifyCFG.cpp. References llvm::pred_begin(), llvm::pred_end(), llvm::ISD::SetEQ, and llvm::ISD::SetNE. Referenced by FoldValueComparisonIntoPredecessors(), and llvm::SimplifyCFG(). |
|
|
SafeToMergeTerminators - Return true if it is safe to merge these two terminator instructions together. Definition at line 338 of file Utils/SimplifyCFG.cpp. References E, llvm::PHINode::getIncomingValueForBlock(), llvm::Instruction::getParent(), I, llvm::succ_begin(), and llvm::succ_end(). Referenced by FoldValueComparisonIntoPredecessors(), and llvm::SimplifyCFG(). |