LLVM
8.0.1
|
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/Support/raw_ostream.h"
#include <queue>
Go to the source code of this file.
Classes | |
class | TypedVReg |
Namespaces | |
llvm | |
This class represents lattice values for constants. | |
Macros | |
#define | DEBUG_TYPE "mir-canonicalizer" |
Enumerations | |
enum | VRType { RSE_Reg = 0, RSE_FrameIndex, RSE_NewCandidate } |
Functions | |
INITIALIZE_PASS_BEGIN (MIRCanonicalizer, "mir-canonicalizer", "Rename Register Operands Canonically", false, false) INITIALIZE_PASS_END(MIRCanonicalizer | |
mir Rename Register Operands static false std::vector< MachineBasicBlock * > | GetRPOList (MachineFunction &MF) |
static bool | rescheduleLexographically (std::vector< MachineInstr *> instructions, MachineBasicBlock *MBB, std::function< MachineBasicBlock::iterator()> getPos) |
static bool | rescheduleCanonically (unsigned &PseudoIdempotentInstCount, MachineBasicBlock *MBB) |
static bool | propagateLocalCopies (MachineBasicBlock *MBB) |
static std::vector< MachineInstr * > | populateCandidates (MachineBasicBlock *MBB) |
Here we find our candidates. More... | |
static void | doCandidateWalk (std::vector< TypedVReg > &VRegs, std::queue< TypedVReg > &RegQueue, std::vector< MachineInstr *> &VisitedMIs, const MachineBasicBlock *MBB) |
static std::map< unsigned, unsigned > | GetVRegRenameMap (const std::vector< TypedVReg > &VRegs, const std::vector< unsigned > &renamedInOtherBB, MachineRegisterInfo &MRI, NamedVRegCursor &NVC) |
static bool | doVRegRenaming (std::vector< unsigned > &RenamedInOtherBB, const std::map< unsigned, unsigned > &VRegRenameMap, MachineRegisterInfo &MRI) |
static bool | doDefKillClear (MachineBasicBlock *MBB) |
static bool | runOnBasicBlock (MachineBasicBlock *MBB, std::vector< StringRef > &bbNames, std::vector< unsigned > &renamedInOtherBB, unsigned &basicBlockNum, unsigned &VRegGapIndex, NamedVRegCursor &NVC) |
Variables | |
char & | llvm::MIRCanonicalizerID = MIRCanonicalizer::ID |
static cl::opt< unsigned > | CanonicalizeFunctionNumber ("canon-nth-function", cl::Hidden, cl::init(~0u), cl::value_desc("N"), cl::desc("Function number to canonicalize.")) |
static cl::opt< unsigned > | CanonicalizeBasicBlockNumber ("canon-nth-basicblock", cl::Hidden, cl::init(~0u), cl::value_desc("N"), cl::desc("BasicBlock number to canonicalize.")) |
mir | canonicalizer |
mir Rename Register Operands | Canonically |
mir Rename Register Operands | false |
#define DEBUG_TYPE "mir-canonicalizer" |
Definition at line 43 of file MIRCanonicalizerPass.cpp.
enum VRType |
Enumerator | |
---|---|
RSE_Reg | |
RSE_FrameIndex | |
RSE_NewCandidate |
Definition at line 75 of file MIRCanonicalizerPass.cpp.
|
static |
Definition at line 396 of file MIRCanonicalizerPass.cpp.
References llvm::any_of(), assert(), llvm::MachineRegisterInfo::createIncompleteVirtualRegister(), llvm::MachineRegisterInfo::createVirtualRegister(), llvm::dbgs(), llvm::tgtok::Def, llvm::MachineRegisterInfo::def_begin(), llvm::MachineRegisterInfo::def_end(), llvm::MachineOperand::dump(), llvm::MachineInstr::dump(), E, llvm::raw_ostream::flush(), llvm::MachineBasicBlock::getName(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineBasicBlock::getParent(), llvm::MachineInstr::getParent(), TypedVReg::getReg(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), I, llvm::MachineOperand::isFI(), TypedVReg::isReg(), llvm::MachineOperand::isReg(), llvm::TargetRegisterInfo::isVirtualRegister(), LLVM_DEBUG, MRI, Reg, RSE_FrameIndex, and llvm::raw_string_ostream::str().
Referenced by runOnBasicBlock().
|
static |
Definition at line 613 of file MIRCanonicalizerPass.cpp.
References MI.
Referenced by runOnBasicBlock().
|
static |
Definition at line 585 of file MIRCanonicalizerPass.cpp.
References E, I, and llvm::MachineRegisterInfo::reg_operands().
Referenced by runOnBasicBlock().
|
static |
Definition at line 107 of file MIRCanonicalizerPass.cpp.
Referenced by runOnBasicBlock().
|
static |
Definition at line 517 of file MIRCanonicalizerPass.cpp.
References llvm::dbgs(), llvm::MachineOperand::dump(), llvm::find(), llvm::MachineRegisterInfo::getRegClass(), llvm::TargetRegisterInfo::isVirtualRegister(), LLVM_DEBUG, Reg, llvm::MachineRegisterInfo::reg_begin(), and llvm::MachineRegisterInfo::reg_end().
Referenced by runOnBasicBlock().
INITIALIZE_PASS_BEGIN | ( | MIRCanonicalizer | , |
"mir-canonicalizer" | , | ||
"Rename Register Operands Canonically" | , | ||
false | , | ||
false | |||
) |
|
static |
Here we find our candidates.
What makes an interesting candidate? An candidate for a canonicalization tree root is normally any kind of instruction that causes side effects such as a store to memory or a copy to a physical register or a return instruction. We use these as an expression tree root that we walk inorder to build a canonical walk which should result in canoncal vreg renaming.
Definition at line 366 of file MIRCanonicalizerPass.cpp.
References llvm::MachineBasicBlock::begin(), llvm::dbgs(), llvm::MachineInstr::dump(), llvm::MachineBasicBlock::end(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineBasicBlock::getParent(), llvm::MachineInstr::getParent(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), llvm::ARM_PROC::IE, llvm::MachineInstr::isBranch(), llvm::MachineOperand::isReg(), llvm::TargetRegisterInfo::isVirtualRegister(), LLVM_DEBUG, llvm::MachineInstr::mayStore(), MI, MRI, llvm::MachineRegisterInfo::use_begin(), and llvm::MachineRegisterInfo::use_end().
Referenced by runOnBasicBlock().
|
static |
Definition at line 321 of file MIRCanonicalizerPass.cpp.
References Copies, llvm::MachineBasicBlock::getParent(), llvm::MachineRegisterInfo::getRegClass(), llvm::MachineFunction::getRegInfo(), llvm::MachineBasicBlock::instrs(), llvm::TargetRegisterInfo::isVirtualRegister(), MI, MRI, llvm::MachineOperand::setReg(), llvm::MachineRegisterInfo::use_begin(), and llvm::MachineRegisterInfo::use_end().
Referenced by runOnBasicBlock().
|
static |
Definition at line 158 of file MIRCanonicalizerPass.cpp.
References llvm::dbgs(), llvm::tgtok::Def, llvm::MachineOperand::dump(), E, llvm::find(), llvm::find_if(), llvm::MachineBasicBlock::getParent(), llvm::MachineInstr::getParent(), llvm::MachineOperand::getReg(), llvm::MachineOperand::isDef(), llvm::MachineOperand::isReg(), llvm::TargetRegisterInfo::isVirtualRegister(), LLVM_DEBUG, MI, MRI, rescheduleLexographically(), and llvm::MachineRegisterInfo::use_nodbg_operands().
Referenced by runOnBasicBlock().
|
static |
Definition at line 118 of file MIRCanonicalizerPass.cpp.
References llvm::dbgs(), llvm::raw_ostream::flush(), LLVM_DEBUG, llvm::sort(), and llvm::MachineBasicBlock::splice().
Referenced by rescheduleCanonically().
|
static |
Definition at line 635 of file MIRCanonicalizerPass.cpp.
References llvm::MachineBasicBlock::begin(), CanonicalizeBasicBlockNumber, CanonicalizeFunctionNumber, llvm::copy(), llvm::dbgs(), doCandidateWalk(), doDefKillClear(), doVRegRenaming(), llvm::MachineOperand::dump(), llvm::MachineBasicBlock::dump(), llvm::MachineBasicBlock::end(), llvm::find(), llvm::MachineBasicBlock::getName(), llvm::MachineFunction::getName(), llvm::MachineInstr::getOperand(), llvm::MachineBasicBlock::getParent(), llvm::MachineOperand::getReg(), llvm::MachineRegisterInfo::getRegClass(), llvm::MachineFunction::getRegInfo(), GetRPOList(), GetVRegRenameMap(), llvm::MachineOperand::isFI(), llvm::MachineOperand::isReg(), llvm::TargetRegisterInfo::isVirtualRegister(), LLVM_DEBUG, MI, MRI, populateCandidates(), propagateLocalCopies(), llvm::MachineRegisterInfo::reg_operands(), rescheduleCanonically(), and RSE_FrameIndex.
Referenced by llvm::BasicBlockPass::BasicBlockPass(), INITIALIZE_PASS(), insertNopBeforeInstruction(), isSecondInstructionInSequence(), llvm::PrintFunctionPass::run(), llvm::SpeculativeExecutionPass::runImpl(), and false::Chain::str().
|
static |
Referenced by runOnBasicBlock().
|
static |
Referenced by runOnBasicBlock().
mir canonicalizer |
Definition at line 104 of file MIRCanonicalizerPass.cpp.
mir Rename Register Operands Canonically |
Definition at line 104 of file MIRCanonicalizerPass.cpp.
mir Rename Register Operands false |
Definition at line 104 of file MIRCanonicalizerPass.cpp.