LLVM
8.0.1
|
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Value.h"
#include "llvm/Pass.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Utils.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <iterator>
#include <limits>
#include <vector>
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "lower-switch" |
Functions | |
static bool | IsInRanges (const IntRange &R, const std::vector< IntRange > &Ranges) |
INITIALIZE_PASS (LowerSwitch, "lowerswitch", "Lower SwitchInst's to branches", false, false) FunctionPass *llvm | |
static LLVM_ATTRIBUTE_USED raw_ostream & | operator<< (raw_ostream &O, const LowerSwitch::CaseVector &C) |
Used for debugging purposes. More... | |
static void | fixPhis (BasicBlock *SuccBB, BasicBlock *OrigBB, BasicBlock *NewBB, unsigned NumMergedCases) |
Update the first occurrence of the "switch statement" BB in the PHI node with the "new" BB. More... | |
#define DEBUG_TYPE "lower-switch" |
Definition at line 43 of file LowerSwitch.cpp.
|
static |
Update the first occurrence of the "switch statement" BB in the PHI node with the "new" BB.
The other occurrences will:
1) Be updated by subsequent calls to this function. Switch statements may have more than one outcoming edge into the same BB if they all have the same value. When the switch statement is converted these incoming edges are now coming from multiple BBs. 2) Removed if subsequent incoming values now share the same case, i.e., multiple outcome edges are condensed into one. This is necessary to keep the number of phi values equal to the number of branches to SuccBB.
Definition at line 182 of file LowerSwitch.cpp.
References llvm::BasicBlock::begin(), E, llvm::BasicBlock::getFirstNonPHI(), llvm::PHINode::getIncomingBlock(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::PHINode::getNumIncomingValues(), I, llvm::ARM_PROC::IE, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::PHINode::removeIncomingValue(), llvm::reverse(), and llvm::PHINode::setIncomingBlock().
INITIALIZE_PASS | ( | LowerSwitch | , |
"lowerswitch" | , | ||
"Lower SwitchInst's to branches" | , | ||
false | , | ||
false | |||
) |
Definition at line 124 of file LowerSwitch.cpp.
References llvm::Function::begin(), llvm::SmallPtrSetImpl< PtrType >::count(), llvm::DeleteDeadBlock(), E, llvm::Function::end(), F(), llvm::BasicBlock::getTerminator(), I, LLVM_ATTRIBUTE_USED, runOnFunction(), and SI.
Definition at line 54 of file LowerSwitch.cpp.
References B, F(), llvm::PassRegistry::getPassRegistry(), High, I, llvm::initializeLowerSwitchPass(), llvm::lower_bound(), runOnFunction(), and SI.
|
static |