#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Analysis/ProfileSummaryInfo.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/CodeGen/MachineMemOperand.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/PseudoSourceValue.h"
#include "llvm/CodeGen/PseudoSourceValueManager.h"
#include "llvm/CodeGen/TargetFrameLowering.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/CodeGen/WasmEHFuncInfo.h"
#include "llvm/CodeGen/WinEHFuncInfo.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/EHPersonalities.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/ModuleSlotTracker.h"
#include "llvm/IR/Value.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/SectionKind.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/DOTGraphTraits.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/GraphWriter.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
#include "LiveDebugValues/LiveDebugValues.h"
usingnamespacellvm;
#define DEBUG_TYPE …
static cl::opt<unsigned> AlignAllFunctions(
"align-all-functions",
cl::desc("Force the alignment of all functions in log2 format (e.g. 4 "
"means align on 16B boundaries)."),
cl::init(0), cl::Hidden);
static const char *getPropertyName(MachineFunctionProperties::Property Prop) { … }
void setUnsafeStackSize(const Function &F, MachineFrameInfo &FrameInfo) { … }
void MachineFunction::Delegate::anchor() { … }
void MachineFunctionProperties::print(raw_ostream &OS) const { … }
MachineFunctionInfo::~MachineFunctionInfo() = default;
void ilist_alloc_traits<MachineBasicBlock>::deleteNode(MachineBasicBlock *MBB) { … }
static inline Align getFnStackAlignment(const TargetSubtargetInfo *STI,
const Function &F) { … }
MachineFunction::MachineFunction(Function &F, const LLVMTargetMachine &Target,
const TargetSubtargetInfo &STI, MCContext &Ctx,
unsigned FunctionNum)
: … { … }
void MachineFunction::handleInsertion(MachineInstr &MI) { … }
void MachineFunction::handleRemoval(MachineInstr &MI) { … }
void MachineFunction::handleChangeDesc(MachineInstr &MI,
const MCInstrDesc &TID) { … }
void MachineFunction::init() { … }
void MachineFunction::initTargetMachineFunctionInfo(
const TargetSubtargetInfo &STI) { … }
MachineFunction::~MachineFunction() { … }
void MachineFunction::clear() { … }
const DataLayout &MachineFunction::getDataLayout() const { … }
MachineJumpTableInfo *MachineFunction::
getOrCreateJumpTableInfo(unsigned EntryKind) { … }
DenormalMode MachineFunction::getDenormalMode(const fltSemantics &FPType) const { … }
bool MachineFunction::shouldSplitStack() const { … }
[[nodiscard]] unsigned
MachineFunction::addFrameInst(const MCCFIInstruction &Inst) { … }
void MachineFunction::RenumberBlocks(MachineBasicBlock *MBB) { … }
void MachineFunction::assignBeginEndSections() { … }
MachineInstr *MachineFunction::CreateMachineInstr(const MCInstrDesc &MCID,
DebugLoc DL,
bool NoImplicit) { … }
MachineInstr *
MachineFunction::CloneMachineInstr(const MachineInstr *Orig) { … }
MachineInstr &MachineFunction::cloneMachineInstrBundle(
MachineBasicBlock &MBB, MachineBasicBlock::iterator InsertBefore,
const MachineInstr &Orig) { … }
void MachineFunction::deleteMachineInstr(MachineInstr *MI) { … }
MachineBasicBlock *
MachineFunction::CreateMachineBasicBlock(const BasicBlock *BB,
std::optional<UniqueBBID> BBID) { … }
void MachineFunction::deleteMachineBasicBlock(MachineBasicBlock *MBB) { … }
MachineMemOperand *MachineFunction::getMachineMemOperand(
MachinePointerInfo PtrInfo, MachineMemOperand::Flags F, LocationSize Size,
Align BaseAlignment, const AAMDNodes &AAInfo, const MDNode *Ranges,
SyncScope::ID SSID, AtomicOrdering Ordering,
AtomicOrdering FailureOrdering) { … }
MachineMemOperand *MachineFunction::getMachineMemOperand(
MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, LLT MemTy,
Align base_alignment, const AAMDNodes &AAInfo, const MDNode *Ranges,
SyncScope::ID SSID, AtomicOrdering Ordering,
AtomicOrdering FailureOrdering) { … }
MachineMemOperand *
MachineFunction::getMachineMemOperand(const MachineMemOperand *MMO,
const MachinePointerInfo &PtrInfo,
LocationSize Size) { … }
MachineMemOperand *MachineFunction::getMachineMemOperand(
const MachineMemOperand *MMO, const MachinePointerInfo &PtrInfo, LLT Ty) { … }
MachineMemOperand *
MachineFunction::getMachineMemOperand(const MachineMemOperand *MMO,
int64_t Offset, LLT Ty) { … }
MachineMemOperand *
MachineFunction::getMachineMemOperand(const MachineMemOperand *MMO,
const AAMDNodes &AAInfo) { … }
MachineMemOperand *
MachineFunction::getMachineMemOperand(const MachineMemOperand *MMO,
MachineMemOperand::Flags Flags) { … }
MachineInstr::ExtraInfo *MachineFunction::createMIExtraInfo(
ArrayRef<MachineMemOperand *> MMOs, MCSymbol *PreInstrSymbol,
MCSymbol *PostInstrSymbol, MDNode *HeapAllocMarker, MDNode *PCSections,
uint32_t CFIType, MDNode *MMRAs) { … }
const char *MachineFunction::createExternalSymbolName(StringRef Name) { … }
uint32_t *MachineFunction::allocateRegMask() { … }
ArrayRef<int> MachineFunction::allocateShuffleMask(ArrayRef<int> Mask) { … }
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void MachineFunction::dump() const {
print(dbgs());
}
#endif
StringRef MachineFunction::getName() const { … }
void MachineFunction::print(raw_ostream &OS, const SlotIndexes *Indexes) const { … }
bool MachineFunction::needsFrameMoves() const { … }
namespace llvm {
template<>
struct DOTGraphTraits<const MachineFunction*> : public DefaultDOTGraphTraits { … };
}
void MachineFunction::viewCFG() const
{ … }
void MachineFunction::viewCFGOnly() const
{ … }
Register MachineFunction::addLiveIn(MCRegister PReg,
const TargetRegisterClass *RC) { … }
MCSymbol *MachineFunction::getJTISymbol(unsigned JTI, MCContext &Ctx,
bool isLinkerPrivate) const { … }
MCSymbol *MachineFunction::getPICBaseSymbol() const { … }
LandingPadInfo &
MachineFunction::getOrCreateLandingPadInfo(MachineBasicBlock *LandingPad) { … }
void MachineFunction::addInvoke(MachineBasicBlock *LandingPad,
MCSymbol *BeginLabel, MCSymbol *EndLabel) { … }
MCSymbol *MachineFunction::addLandingPad(MachineBasicBlock *LandingPad) { … }
void MachineFunction::setCallSiteLandingPad(MCSymbol *Sym,
ArrayRef<unsigned> Sites) { … }
unsigned MachineFunction::getTypeIDFor(const GlobalValue *TI) { … }
int MachineFunction::getFilterIDFor(ArrayRef<unsigned> TyIds) { … }
MachineFunction::CallSiteInfoMap::iterator
MachineFunction::getCallSiteInfo(const MachineInstr *MI) { … }
static const MachineInstr *getCallInstr(const MachineInstr *MI) { … }
void MachineFunction::eraseCallSiteInfo(const MachineInstr *MI) { … }
void MachineFunction::copyCallSiteInfo(const MachineInstr *Old,
const MachineInstr *New) { … }
void MachineFunction::moveCallSiteInfo(const MachineInstr *Old,
const MachineInstr *New) { … }
void MachineFunction::setDebugInstrNumberingCount(unsigned Num) { … }
void MachineFunction::makeDebugValueSubstitution(DebugInstrOperandPair A,
DebugInstrOperandPair B,
unsigned Subreg) { … }
void MachineFunction::substituteDebugValuesForInst(const MachineInstr &Old,
MachineInstr &New,
unsigned MaxOperand) { … }
auto MachineFunction::salvageCopySSA(
MachineInstr &MI, DenseMap<Register, DebugInstrOperandPair> &DbgPHICache)
-> DebugInstrOperandPair { … }
auto MachineFunction::salvageCopySSAImpl(MachineInstr &MI)
-> DebugInstrOperandPair { … }
void MachineFunction::finalizeDebugInstrRefs() { … }
bool MachineFunction::shouldUseDebugInstrRef() const { … }
bool MachineFunction::useDebugInstrRef() const { … }
void MachineFunction::setUseDebugInstrRef(bool Use) { … }
const unsigned MachineFunction::DebugOperandMemNumber = …;
unsigned MachineJumpTableInfo::getEntrySize(const DataLayout &TD) const { … }
unsigned MachineJumpTableInfo::getEntryAlignment(const DataLayout &TD) const { … }
unsigned MachineJumpTableInfo::createJumpTableIndex(
const std::vector<MachineBasicBlock*> &DestBBs) { … }
bool MachineJumpTableInfo::ReplaceMBBInJumpTables(MachineBasicBlock *Old,
MachineBasicBlock *New) { … }
bool MachineJumpTableInfo::RemoveMBBFromJumpTables(MachineBasicBlock *MBB) { … }
bool MachineJumpTableInfo::ReplaceMBBInJumpTable(unsigned Idx,
MachineBasicBlock *Old,
MachineBasicBlock *New) { … }
void MachineJumpTableInfo::print(raw_ostream &OS) const { … }
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void MachineJumpTableInfo::dump() const { print(dbgs()); }
#endif
Printable llvm::printJumpTableEntryReference(unsigned Idx) { … }
void MachineConstantPoolValue::anchor() { … }
unsigned MachineConstantPoolValue::getSizeInBytes(const DataLayout &DL) const { … }
unsigned MachineConstantPoolEntry::getSizeInBytes(const DataLayout &DL) const { … }
bool MachineConstantPoolEntry::needsRelocation() const { … }
SectionKind
MachineConstantPoolEntry::getSectionKind(const DataLayout *DL) const { … }
MachineConstantPool::~MachineConstantPool() { … }
static bool CanShareConstantPoolEntry(const Constant *A, const Constant *B,
const DataLayout &DL) { … }
unsigned MachineConstantPool::getConstantPoolIndex(const Constant *C,
Align Alignment) { … }
unsigned MachineConstantPool::getConstantPoolIndex(MachineConstantPoolValue *V,
Align Alignment) { … }
void MachineConstantPool::print(raw_ostream &OS) const { … }
template <>
std::optional<Function::ProfileCount>
ProfileSummaryInfo::getEntryCount<llvm::MachineFunction>(
const llvm::MachineFunction *F) const { … }
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void MachineConstantPool::dump() const { print(dbgs()); }
#endif