#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/CodeGen/LiveIntervals.h"
#include "llvm/CodeGen/LivePhysRegs.h"
#include "llvm/CodeGen/LiveVariables.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/SlotIndexes.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/ModuleSlotTracker.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
#include <algorithm>
#include <cmath>
usingnamespacellvm;
#define DEBUG_TYPE …
static cl::opt<bool> PrintSlotIndexes(
"print-slotindexes",
cl::desc("When printing machine IR, annotate instructions and blocks with "
"SlotIndexes when available"),
cl::init(true), cl::Hidden);
MachineBasicBlock::MachineBasicBlock(MachineFunction &MF, const BasicBlock *B)
: … { … }
MachineBasicBlock::~MachineBasicBlock() = default;
MCSymbol *MachineBasicBlock::getSymbol() const { … }
MCSymbol *MachineBasicBlock::getEHCatchretSymbol() const { … }
MCSymbol *MachineBasicBlock::getEndSymbol() const { … }
raw_ostream &llvm::operator<<(raw_ostream &OS, const MachineBasicBlock &MBB) { … }
Printable llvm::printMBBReference(const MachineBasicBlock &MBB) { … }
void ilist_callback_traits<MachineBasicBlock>::addNodeToList(
MachineBasicBlock *N) { … }
void ilist_callback_traits<MachineBasicBlock>::removeNodeFromList(
MachineBasicBlock *N) { … }
void ilist_traits<MachineInstr>::addNodeToList(MachineInstr *N) { … }
void ilist_traits<MachineInstr>::removeNodeFromList(MachineInstr *N) { … }
void ilist_traits<MachineInstr>::transferNodesFromList(ilist_traits &FromList,
instr_iterator First,
instr_iterator Last) { … }
void ilist_traits<MachineInstr>::deleteNode(MachineInstr *MI) { … }
MachineBasicBlock::iterator MachineBasicBlock::getFirstNonPHI() { … }
MachineBasicBlock::iterator
MachineBasicBlock::SkipPHIsAndLabels(MachineBasicBlock::iterator I) { … }
MachineBasicBlock::iterator
MachineBasicBlock::SkipPHIsLabelsAndDebug(MachineBasicBlock::iterator I,
Register Reg, bool SkipPseudoOp) { … }
MachineBasicBlock::iterator MachineBasicBlock::getFirstTerminator() { … }
MachineBasicBlock::instr_iterator MachineBasicBlock::getFirstInstrTerminator() { … }
MachineBasicBlock::iterator MachineBasicBlock::getFirstTerminatorForward() { … }
MachineBasicBlock::iterator
MachineBasicBlock::getFirstNonDebugInstr(bool SkipPseudoOp) { … }
MachineBasicBlock::iterator
MachineBasicBlock::getLastNonDebugInstr(bool SkipPseudoOp) { … }
bool MachineBasicBlock::hasEHPadSuccessor() const { … }
bool MachineBasicBlock::isEntryBlock() const { … }
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void MachineBasicBlock::dump() const {
print(dbgs());
}
#endif
bool MachineBasicBlock::mayHaveInlineAsmBr() const { … }
bool MachineBasicBlock::isLegalToHoistInto() const { … }
bool MachineBasicBlock::hasName() const { … }
StringRef MachineBasicBlock::getName() const { … }
std::string MachineBasicBlock::getFullName() const { … }
void MachineBasicBlock::print(raw_ostream &OS, const SlotIndexes *Indexes,
bool IsStandalone) const { … }
void MachineBasicBlock::print(raw_ostream &OS, ModuleSlotTracker &MST,
const SlotIndexes *Indexes,
bool IsStandalone) const { … }
void MachineBasicBlock::printName(raw_ostream &os, unsigned printNameFlags,
ModuleSlotTracker *moduleSlotTracker) const { … }
void MachineBasicBlock::printAsOperand(raw_ostream &OS,
bool ) const { … }
void MachineBasicBlock::removeLiveIn(MCRegister Reg, LaneBitmask LaneMask) { … }
MachineBasicBlock::livein_iterator
MachineBasicBlock::removeLiveIn(MachineBasicBlock::livein_iterator I) { … }
bool MachineBasicBlock::isLiveIn(MCRegister Reg, LaneBitmask LaneMask) const { … }
void MachineBasicBlock::sortUniqueLiveIns() { … }
Register
MachineBasicBlock::addLiveIn(MCRegister PhysReg, const TargetRegisterClass *RC) { … }
void MachineBasicBlock::moveBefore(MachineBasicBlock *NewAfter) { … }
void MachineBasicBlock::moveAfter(MachineBasicBlock *NewBefore) { … }
static int findJumpTableIndex(const MachineBasicBlock &MBB) { … }
void MachineBasicBlock::updateTerminator(
MachineBasicBlock *PreviousLayoutSuccessor) { … }
void MachineBasicBlock::validateSuccProbs() const { … }
void MachineBasicBlock::addSuccessor(MachineBasicBlock *Succ,
BranchProbability Prob) { … }
void MachineBasicBlock::addSuccessorWithoutProb(MachineBasicBlock *Succ) { … }
void MachineBasicBlock::splitSuccessor(MachineBasicBlock *Old,
MachineBasicBlock *New,
bool NormalizeSuccProbs) { … }
void MachineBasicBlock::removeSuccessor(MachineBasicBlock *Succ,
bool NormalizeSuccProbs) { … }
MachineBasicBlock::succ_iterator
MachineBasicBlock::removeSuccessor(succ_iterator I, bool NormalizeSuccProbs) { … }
void MachineBasicBlock::replaceSuccessor(MachineBasicBlock *Old,
MachineBasicBlock *New) { … }
void MachineBasicBlock::copySuccessor(const MachineBasicBlock *Orig,
succ_iterator I) { … }
void MachineBasicBlock::addPredecessor(MachineBasicBlock *Pred) { … }
void MachineBasicBlock::removePredecessor(MachineBasicBlock *Pred) { … }
void MachineBasicBlock::transferSuccessors(MachineBasicBlock *FromMBB) { … }
void
MachineBasicBlock::transferSuccessorsAndUpdatePHIs(MachineBasicBlock *FromMBB) { … }
bool MachineBasicBlock::isPredecessor(const MachineBasicBlock *MBB) const { … }
bool MachineBasicBlock::isSuccessor(const MachineBasicBlock *MBB) const { … }
bool MachineBasicBlock::isLayoutSuccessor(const MachineBasicBlock *MBB) const { … }
const MachineBasicBlock *MachineBasicBlock::getSingleSuccessor() const { … }
const MachineBasicBlock *MachineBasicBlock::getSinglePredecessor() const { … }
MachineBasicBlock *MachineBasicBlock::getFallThrough(bool JumpToFallThrough) { … }
bool MachineBasicBlock::canFallThrough() { … }
MachineBasicBlock *MachineBasicBlock::splitAt(MachineInstr &MI,
bool UpdateLiveIns,
LiveIntervals *LIS) { … }
static bool jumpTableHasOtherUses(const MachineFunction &MF,
const MachineBasicBlock &IgnoreMBB,
int JumpTableIndex) { … }
class SlotIndexUpdateDelegate : public MachineFunction::Delegate { … };
#define GET_RESULT(RESULT, GETTER, INFIX) …
MachineBasicBlock *MachineBasicBlock::SplitCriticalEdge(
MachineBasicBlock *Succ, Pass *P, MachineFunctionAnalysisManager *MFAM,
std::vector<SparseBitVector<>> *LiveInSets) { … }
bool MachineBasicBlock::canSplitCriticalEdge(
const MachineBasicBlock *Succ) const { … }
static void unbundleSingleMI(MachineInstr *MI) { … }
MachineBasicBlock::instr_iterator
MachineBasicBlock::erase(MachineBasicBlock::instr_iterator I) { … }
MachineInstr *MachineBasicBlock::remove_instr(MachineInstr *MI) { … }
MachineBasicBlock::instr_iterator
MachineBasicBlock::insert(instr_iterator I, MachineInstr *MI) { … }
MachineBasicBlock *MachineBasicBlock::removeFromParent() { … }
void MachineBasicBlock::eraseFromParent() { … }
void MachineBasicBlock::ReplaceUsesOfBlockWith(MachineBasicBlock *Old,
MachineBasicBlock *New) { … }
void MachineBasicBlock::replacePhiUsesWith(MachineBasicBlock *Old,
MachineBasicBlock *New) { … }
DebugLoc
MachineBasicBlock::findDebugLoc(instr_iterator MBBI) { … }
DebugLoc MachineBasicBlock::rfindDebugLoc(reverse_instr_iterator MBBI) { … }
DebugLoc MachineBasicBlock::findPrevDebugLoc(instr_iterator MBBI) { … }
DebugLoc MachineBasicBlock::rfindPrevDebugLoc(reverse_instr_iterator MBBI) { … }
DebugLoc
MachineBasicBlock::findBranchDebugLoc() { … }
BranchProbability
MachineBasicBlock::getSuccProbability(const_succ_iterator Succ) const { … }
void MachineBasicBlock::setSuccProbability(succ_iterator I,
BranchProbability Prob) { … }
MachineBasicBlock::const_probability_iterator
MachineBasicBlock::getProbabilityIterator(
MachineBasicBlock::const_succ_iterator I) const { … }
MachineBasicBlock::probability_iterator
MachineBasicBlock::getProbabilityIterator(MachineBasicBlock::succ_iterator I) { … }
MachineBasicBlock::LivenessQueryResult
MachineBasicBlock::computeRegisterLiveness(const TargetRegisterInfo *TRI,
MCRegister Reg, const_iterator Before,
unsigned Neighborhood) const { … }
const uint32_t *
MachineBasicBlock::getBeginClobberMask(const TargetRegisterInfo *TRI) const { … }
const uint32_t *
MachineBasicBlock::getEndClobberMask(const TargetRegisterInfo *TRI) const { … }
void MachineBasicBlock::clearLiveIns() { … }
void MachineBasicBlock::clearLiveIns(
std::vector<RegisterMaskPair> &OldLiveIns) { … }
MachineBasicBlock::livein_iterator MachineBasicBlock::livein_begin() const { … }
MachineBasicBlock::liveout_iterator MachineBasicBlock::liveout_begin() const { … }
bool MachineBasicBlock::sizeWithoutDebugLargerThan(unsigned Limit) const { … }
const MBBSectionID MBBSectionID::ColdSectionID(MBBSectionID::SectionType::Cold);
const MBBSectionID
MBBSectionID::ExceptionSectionID(MBBSectionID::SectionType::Exception);