#include "llvm/IR/BasicBlock.h"
#include "SymbolTableListTraitsImpl.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DebugProgramInstruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Type.h"
#include "llvm/Support/CommandLine.h"
#include "LLVMContextImpl.h"
usingnamespacellvm;
#define DEBUG_TYPE …
STATISTIC(NumInstrRenumberings, "Number of renumberings across all blocks");
cl::opt<bool> UseNewDbgInfoFormat(
"experimental-debuginfo-iterators",
cl::desc("Enable communicating debuginfo positions through iterators, "
"eliminating intrinsics. Has no effect if "
"--preserve-input-debuginfo-format=true."),
cl::init(true));
cl::opt<cl::boolOrDefault> PreserveInputDbgFormat(
"preserve-input-debuginfo-format", cl::Hidden,
cl::desc("When set to true, IR files will be processed and printed in "
"their current debug info format, regardless of default behaviour "
"or other flags passed. Has no effect if input IR does not "
"contain debug records or intrinsics. Ignored in llvm-link, "
"llvm-lto, and llvm-lto2."));
bool WriteNewDbgInfoFormatToBitcode ;
cl::opt<bool, true> WriteNewDbgInfoFormatToBitcode2(
"write-experimental-debuginfo-iterators-to-bitcode", cl::Hidden,
cl::location(WriteNewDbgInfoFormatToBitcode), cl::init(true));
DbgMarker *BasicBlock::createMarker(Instruction *I) { … }
DbgMarker *BasicBlock::createMarker(InstListType::iterator It) { … }
void BasicBlock::convertToNewDbgValues() { … }
void BasicBlock::convertFromNewDbgValues() { … }
#ifndef NDEBUG
void BasicBlock::dumpDbgValues() const {
for (auto &Inst : *this) {
if (!Inst.DebugMarker)
continue;
dbgs() << "@ " << Inst.DebugMarker << " ";
Inst.DebugMarker->dump();
};
}
#endif
void BasicBlock::setIsNewDbgInfoFormat(bool NewFlag) { … }
void BasicBlock::setNewDbgInfoFormatFlag(bool NewFlag) { … }
ValueSymbolTable *BasicBlock::getValueSymbolTable() { … }
LLVMContext &BasicBlock::getContext() const { … }
template <> void llvm::invalidateParentIListOrdering(BasicBlock *BB) { … }
template class llvm::SymbolTableListTraits<
Instruction, ilist_iterator_bits<true>, ilist_parent<BasicBlock>>;
BasicBlock::BasicBlock(LLVMContext &C, const Twine &Name, Function *NewParent,
BasicBlock *InsertBefore)
: … { … }
void BasicBlock::insertInto(Function *NewParent, BasicBlock *InsertBefore) { … }
BasicBlock::~BasicBlock() { … }
void BasicBlock::setParent(Function *parent) { … }
iterator_range<filter_iterator<BasicBlock::const_iterator,
std::function<bool(const Instruction &)>>>
BasicBlock::instructionsWithoutDebug(bool SkipPseudoOp) const { … }
iterator_range<
filter_iterator<BasicBlock::iterator, std::function<bool(Instruction &)>>>
BasicBlock::instructionsWithoutDebug(bool SkipPseudoOp) { … }
filter_iterator<BasicBlock::const_iterator,
std::function<bool(const Instruction &)>>::difference_type
BasicBlock::sizeWithoutDebug() const { … }
void BasicBlock::removeFromParent() { … }
iplist<BasicBlock>::iterator BasicBlock::eraseFromParent() { … }
void BasicBlock::moveBefore(SymbolTableList<BasicBlock>::iterator MovePos) { … }
void BasicBlock::moveAfter(BasicBlock *MovePos) { … }
const Module *BasicBlock::getModule() const { … }
const DataLayout &BasicBlock::getDataLayout() const { … }
const CallInst *BasicBlock::getTerminatingMustTailCall() const { … }
const CallInst *BasicBlock::getTerminatingDeoptimizeCall() const { … }
const CallInst *BasicBlock::getPostdominatingDeoptimizeCall() const { … }
const Instruction *BasicBlock::getFirstMayFaultInst() const { … }
const Instruction* BasicBlock::getFirstNonPHI() const { … }
BasicBlock::const_iterator BasicBlock::getFirstNonPHIIt() const { … }
const Instruction *BasicBlock::getFirstNonPHIOrDbg(bool SkipPseudoOp) const { … }
const Instruction *
BasicBlock::getFirstNonPHIOrDbgOrLifetime(bool SkipPseudoOp) const { … }
BasicBlock::const_iterator BasicBlock::getFirstInsertionPt() const { … }
BasicBlock::const_iterator BasicBlock::getFirstNonPHIOrDbgOrAlloca() const { … }
void BasicBlock::dropAllReferences() { … }
const BasicBlock *BasicBlock::getSinglePredecessor() const { … }
const BasicBlock *BasicBlock::getUniquePredecessor() const { … }
bool BasicBlock::hasNPredecessors(unsigned N) const { … }
bool BasicBlock::hasNPredecessorsOrMore(unsigned N) const { … }
const BasicBlock *BasicBlock::getSingleSuccessor() const { … }
const BasicBlock *BasicBlock::getUniqueSuccessor() const { … }
iterator_range<BasicBlock::phi_iterator> BasicBlock::phis() { … }
void BasicBlock::removePredecessor(BasicBlock *Pred,
bool KeepOneInputPHIs) { … }
bool BasicBlock::canSplitPredecessors() const { … }
bool BasicBlock::isLegalToHoistInto() const { … }
bool BasicBlock::isEntryBlock() const { … }
BasicBlock *BasicBlock::splitBasicBlock(iterator I, const Twine &BBName,
bool Before) { … }
BasicBlock *BasicBlock::splitBasicBlockBefore(iterator I, const Twine &BBName) { … }
BasicBlock::iterator BasicBlock::erase(BasicBlock::iterator FromIt,
BasicBlock::iterator ToIt) { … }
void BasicBlock::replacePhiUsesWith(BasicBlock *Old, BasicBlock *New) { … }
void BasicBlock::replaceSuccessorsPhiUsesWith(BasicBlock *Old,
BasicBlock *New) { … }
void BasicBlock::replaceSuccessorsPhiUsesWith(BasicBlock *New) { … }
bool BasicBlock::isLandingPad() const { … }
const LandingPadInst *BasicBlock::getLandingPadInst() const { … }
std::optional<uint64_t> BasicBlock::getIrrLoopHeaderWeight() const { … }
BasicBlock::iterator llvm::skipDebugIntrinsics(BasicBlock::iterator It) { … }
void BasicBlock::renumberInstructions() { … }
void BasicBlock::flushTerminatorDbgRecords() { … }
void BasicBlock::spliceDebugInfoEmptyBlock(BasicBlock::iterator Dest,
BasicBlock *Src,
BasicBlock::iterator First,
BasicBlock::iterator Last) { … }
void BasicBlock::spliceDebugInfo(BasicBlock::iterator Dest, BasicBlock *Src,
BasicBlock::iterator First,
BasicBlock::iterator Last) { … }
void BasicBlock::spliceDebugInfoImpl(BasicBlock::iterator Dest, BasicBlock *Src,
BasicBlock::iterator First,
BasicBlock::iterator Last) { … }
void BasicBlock::splice(iterator Dest, BasicBlock *Src, iterator First,
iterator Last) { … }
void BasicBlock::insertDbgRecordAfter(DbgRecord *DR, Instruction *I) { … }
void BasicBlock::insertDbgRecordBefore(DbgRecord *DR,
InstListType::iterator Where) { … }
DbgMarker *BasicBlock::getNextMarker(Instruction *I) { … }
DbgMarker *BasicBlock::getMarker(InstListType::iterator It) { … }
void BasicBlock::reinsertInstInDbgRecords(
Instruction *I, std::optional<DbgRecord::self_iterator> Pos) { … }
#ifndef NDEBUG
void BasicBlock::validateInstrOrdering() const {
if (!isInstrOrderValid())
return;
const Instruction *Prev = nullptr;
for (const Instruction &I : *this) {
assert((!Prev || Prev->comesBefore(&I)) &&
"cached instruction ordering is incorrect");
Prev = &I;
}
}
#endif
void BasicBlock::setTrailingDbgRecords(DbgMarker *foo) { … }
DbgMarker *BasicBlock::getTrailingDbgRecords() { … }
void BasicBlock::deleteTrailingDbgRecords() { … }