|
LLVM 24.0.0git
|
#include "llvm/CodeGen/IfConversion.h"#include "BranchFolding.h"#include "CodeGenOptions.h"#include "llvm/ADT/STLExtras.h"#include "llvm/ADT/ScopeExit.h"#include "llvm/ADT/SmallSet.h"#include "llvm/ADT/SmallVector.h"#include "llvm/ADT/SparseSet.h"#include "llvm/ADT/Statistic.h"#include "llvm/ADT/iterator_range.h"#include "llvm/Analysis/ProfileSummaryInfo.h"#include "llvm/CodeGen/LivePhysRegs.h"#include "llvm/CodeGen/MBFIWrapper.h"#include "llvm/CodeGen/MachineBasicBlock.h"#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"#include "llvm/CodeGen/MachineBranchProbabilityInfo.h"#include "llvm/CodeGen/MachineFunction.h"#include "llvm/CodeGen/MachineFunctionAnalysisManager.h"#include "llvm/CodeGen/MachineFunctionPass.h"#include "llvm/CodeGen/MachineInstr.h"#include "llvm/CodeGen/MachineInstrBuilder.h"#include "llvm/CodeGen/MachineOperand.h"#include "llvm/CodeGen/MachinePassManager.h"#include "llvm/CodeGen/MachineRegisterInfo.h"#include "llvm/CodeGen/RegisterClassInfo.h"#include "llvm/CodeGen/TargetInstrInfo.h"#include "llvm/CodeGen/TargetRegisterInfo.h"#include "llvm/CodeGen/TargetSchedule.h"#include "llvm/CodeGen/TargetSubtargetInfo.h"#include "llvm/IR/Analysis.h"#include "llvm/IR/DebugLoc.h"#include "llvm/InitializePasses.h"#include "llvm/Pass.h"#include "llvm/Support/BranchProbability.h"#include "llvm/Support/Debug.h"#include "llvm/Support/ErrorHandling.h"#include "llvm/Support/raw_ostream.h"#include <algorithm>#include <cassert>#include <functional>#include <iterator>#include <memory>#include <utility>#include <vector>Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "if-converter" |
Functions | |
| STATISTIC (NumSimple, "Number of simple if-conversions performed") | |
| STATISTIC (NumSimpleFalse, "Number of simple (F) if-conversions performed") | |
| STATISTIC (NumTriangle, "Number of triangle if-conversions performed") | |
| STATISTIC (NumTriangleRev, "Number of triangle (R) if-conversions performed") | |
| STATISTIC (NumTriangleFalse,"Number of triangle (F) if-conversions performed") | |
| STATISTIC (NumTriangleFRev, "Number of triangle (F/R) if-conversions performed") | |
| STATISTIC (NumDiamonds, "Number of diamond if-conversions performed") | |
| STATISTIC (NumForkedDiamonds, "Number of forked-diamond if-conversions performed") | |
| STATISTIC (NumIfConvBBs, "Number of if-converted blocks") | |
| STATISTIC (NumDupBBs, "Number of duplicated blocks") | |
| STATISTIC (NumUnpred, "Number of true blocks of diamonds unpredicated") | |
| INITIALIZE_PASS_BEGIN (IfConverterLegacy, DEBUG_TYPE, "If Converter", false, false) bool IfConverterImpl | |
| static MachineBasicBlock * | findFalseBlock (MachineBasicBlock *BB, MachineBasicBlock *TrueBB) |
| BB has a fallthrough. Find its 'false' successor given its 'true' successor. | |
| static MachineBasicBlock * | getNextBlock (MachineBasicBlock &MBB) |
| Returns the next block in the function blocks ordering. | |
| static void | verifySameBranchInstructions (MachineBasicBlock *MBB1, MachineBasicBlock *MBB2) |
| static bool | canFallThroughTo (MachineBasicBlock &MBB, MachineBasicBlock &ToMBB) |
| Returns true either if ToMBB is the next block after MBB or that all the intervening blocks are empty (given MBB can fall through to its next block). | |
| static void | InsertUncondBranch (MachineBasicBlock &MBB, MachineBasicBlock &ToMBB, const TargetInstrInfo *TII) |
Inserts an unconditional branch from MBB to ToMBB. | |
| static void | UpdatePredRedefs (MachineInstr &MI, LivePhysRegs &Redefs) |
| Behaves like LivePhysRegs::stepForward() but also adds implicit uses to all values defined in MI which are also live/used by MI. | |
| static bool | MaySpeculate (const MachineInstr &MI, SmallSet< MCRegister, 4 > &LaterRedefs) |
| #define DEBUG_TYPE "if-converter" |
Definition at line 61 of file IfConversion.cpp.
|
static |
Returns true either if ToMBB is the next block after MBB or that all the intervening blocks are empty (given MBB can fall through to its next block).
Definition at line 1451 of file IfConversion.cpp.
References E(), llvm::ilist_node_impl< OptionsT >::getIterator(), I, and MBB.
|
static |
BB has a fallthrough. Find its 'false' successor given its 'true' successor.
Definition at line 622 of file IfConversion.cpp.
References llvm::MachineBasicBlock::successors().
|
inlinestatic |
Returns the next block in the function blocks ordering.
If it is the end, returns NULL.
Definition at line 646 of file IfConversion.cpp.
| INITIALIZE_PASS_BEGIN | ( | IfConverterLegacy | , |
| DEBUG_TYPE | , | ||
| "If Converter" | , | ||
| false | , | ||
| false | ) |
Definition at line 437 of file IfConversion.cpp.
References const, llvm::dbgs(), DEBUG_TYPE, llvm::getCodeGenOptions(), llvm::TargetSchedModel::init(), INITIALIZE_PASS_DEPENDENCY, INITIALIZE_PASS_END, LLVM_DEBUG, llvm_unreachable, MRI, llvm::BranchFolder::OptimizeFunction(), llvm::printMBBReference(), llvm::recomputeLivenessFlags(), TII, and TRI.
|
static |
Inserts an unconditional branch from MBB to ToMBB.
Definition at line 1480 of file IfConversion.cpp.
|
static |
Definition at line 2106 of file IfConversion.cpp.
References llvm::SmallSet< T, N, C >::count(), MI, and Reg.
| STATISTIC | ( | NumDiamonds | , |
| "Number of diamond if-conversions performed" | ) |
| STATISTIC | ( | NumDupBBs | , |
| "Number of duplicated blocks" | ) |
| STATISTIC | ( | NumForkedDiamonds | , |
| "Number of forked-diamond if-conversions performed" | ) |
| STATISTIC | ( | NumIfConvBBs | , |
| "Number of if-converted blocks" | ) |
| STATISTIC | ( | NumSimple | , |
| "Number of simple if-conversions performed" | ) |
| STATISTIC | ( | NumTriangle | , |
| "Number of triangle if-conversions performed" | ) |
| STATISTIC | ( | NumTriangleRev | , |
| "Number of triangle (R) if-conversions performed" | ) |
| STATISTIC | ( | NumUnpred | , |
| "Number of true blocks of diamonds unpredicated" | ) |
|
static |
Behaves like LivePhysRegs::stepForward() but also adds implicit uses to all values defined in MI which are also live/used by MI.
Definition at line 1489 of file IfConversion.cpp.
References llvm::MachineInstrBuilder::addReg(), llvm::any_of(), llvm::SparseSet< ValueT, KeyT, KeyFunctorT, SparseT >::count(), llvm::Define, llvm::MachineInstr::getMF(), llvm::Implicit, llvm::SparseSet< ValueT, KeyT, KeyFunctorT, SparseT >::insert(), MI, Reg, llvm::SparseSet< ValueT, KeyT, KeyFunctorT, SparseT >::setUniverse(), llvm::LivePhysRegs::stepForward(), and TRI.
|
static |
Definition at line 841 of file IfConversion.cpp.
References assert(), llvm::MachineBasicBlock::rbegin(), llvm::MachineBasicBlock::rend(), and llvm::skipDebugInstructionsForward().