Go to the documentation of this file.
42 #include "llvm/Config/llvm-config.h"
75 #include <type_traits>
81 #define DEBUG_TYPE "codegen"
84 "align-all-functions",
85 cl::desc(
"Force the alignment of all functions in log2 format (e.g. 4 "
86 "means align on 16B boundaries)."),
93 case P::FailedISel:
return "FailedISel";
94 case P::IsSSA:
return "IsSSA";
95 case P::Legalized:
return "Legalized";
96 case P::NoPHIs:
return "NoPHIs";
97 case P::NoVRegs:
return "NoVRegs";
98 case P::RegBankSelected:
return "RegBankSelected";
99 case P::Selected:
return "Selected";
100 case P::TracksLiveness:
return "TracksLiveness";
101 case P::TiedOpsRewritten:
return "TiedOpsRewritten";
107 void MachineFunction::Delegate::anchor() {}
110 const char *Separator =
"";
114 OS << Separator << getPropertyName(static_cast<Property>(
I));
132 if (
F.hasFnAttribute(Attribute::StackAlignment))
133 return F.getFnStackAlignment();
141 FunctionNumber = FunctionNum;
155 void MachineFunction::init() {
189 JumpTableInfo =
nullptr;
202 "Can't create a MachineFunction using a Module with a "
203 "Target-incompatible DataLayout attached\n");
206 std::make_unique<PseudoSourceValueManager>(*(
getSubtarget().
214 void MachineFunction::clear() {
221 I->Insts.clearAndLeakNodesUnsafely();
222 MBBNumbering.clear();
224 InstructionRecycler.clear(Allocator);
225 OperandRecycler.
clear(Allocator);
226 BasicBlockRecycler.clear(Allocator);
227 CodeViewAnnotations.clear();
230 RegInfo->~MachineRegisterInfo();
238 FrameInfo->~MachineFrameInfo();
245 JumpTableInfo->~MachineJumpTableInfo();
250 WinEHInfo->~WinEHFuncInfo();
255 WasmEHInfo->~WasmEHFuncInfo();
268 if (JumpTableInfo)
return JumpTableInfo;
270 JumpTableInfo =
new (Allocator)
272 return JumpTableInfo;
286 FrameInstructions.push_back(Inst);
287 return FrameInstructions.size() - 1;
295 if (
empty()) { MBBNumbering.clear();
return; }
303 unsigned BlockNo = 0;
305 BlockNo = std::prev(
MBBI)->getNumber() + 1;
312 "MBB number mismatch!");
317 if (MBBNumbering[BlockNo])
318 MBBNumbering[BlockNo]->setNumber(-1);
320 MBBNumbering[BlockNo] = &*
MBBI;
327 assert(BlockNo <= MBBNumbering.size() &&
"Mismatch!");
328 MBBNumbering.resize(BlockNo);
341 std::prev(
MBBI)->setIsEndSection();
351 return new (InstructionRecycler.Allocate<
MachineInstr>(Allocator))
359 return new (InstructionRecycler.Allocate<
MachineInstr>(Allocator))
370 if (FirstClone ==
nullptr) {
376 if (!
I->isBundledWithSucc())
398 assert((!
MI->isCandidateForCallSiteEntry() ||
399 CallSitesInfo.
find(
MI) == CallSitesInfo.
end()) &&
400 "Call site info was not updated!");
408 InstructionRecycler.Deallocate(Allocator,
MI);
426 MBB->~MachineBasicBlock();
427 BasicBlockRecycler.Deallocate(Allocator,
MBB);
435 return new (Allocator)
437 SSID, Ordering, FailureOrdering);
460 return new (Allocator)
491 return MachineInstr::ExtraInfo::create(Allocator, MMOs, PreInstrSymbol,
492 PostInstrSymbol, HeapAllocMarker);
498 Dest[
Name.size()] = 0;
513 return {AllocMask,
Mask.size()};
516 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
527 OS <<
"# Machine code for function " <<
getName() <<
": ";
532 FrameInfo->
print(*
this, OS);
536 JumpTableInfo->
print(OS);
544 OS <<
"Function Live Ins: ";
550 if (std::next(
I) !=
E)
558 for (
const auto &
BB : *
this) {
561 BB.print(OS, MST, Indexes,
true);
564 OS <<
"\n# End machine code for function " <<
getName() <<
".\n\n";
581 return (
"CFG for '" +
F->getName() +
"' function").str();
593 OSS <<
": " <<
BB->getName();
598 if (OutStr[0] ==
'\n') OutStr.erase(OutStr.begin());
601 for (
unsigned i = 0;
i != OutStr.length(); ++
i)
602 if (OutStr[
i] ==
'\n') {
604 OutStr.insert(OutStr.begin()+
i+1,
'l');
617 errs() <<
"MachineFunction::viewCFG is only available in debug builds on "
618 <<
"systems with Graphviz or gv!\n";
627 errs() <<
"MachineFunction::viewCFGOnly is only available in debug builds on "
628 <<
"systems with Graphviz or gv!\n";
648 "Register class mismatch!");
660 bool isLinkerPrivate)
const {
662 assert(JumpTableInfo &&
"No jump tables");
663 assert(JTI < JumpTableInfo->getJumpTables().
size() &&
"Invalid JTI!");
666 :
DL.getPrivateGlobalPrefix();
685 unsigned N = LandingPads.size();
686 for (
unsigned i = 0;
i <
N; ++
i) {
693 return LandingPads[
N];
709 if (
const auto *LPI = dyn_cast<LandingPadInst>(FirstI)) {
711 dyn_cast<Function>(
F.getPersonalityFn()->stripPointerCasts()))
714 if (LPI->isCleanup())
720 for (
unsigned I = LPI->getNumClauses();
I != 0; --
I) {
721 Value *Val = LPI->getClause(
I - 1);
722 if (LPI->isCatch(
I - 1)) {
727 auto *CVal = cast<Constant>(Val);
731 FilterList.push_back(cast<GlobalValue>((*II)->stripPointerCasts()));
737 }
else if (
const auto *CPI = dyn_cast<CatchPadInst>(FirstI)) {
738 for (
unsigned I = CPI->getNumArgOperands();
I != 0; --
I) {
744 assert(isa<CleanupPadInst>(FirstI) &&
"Invalid landingpad!");
747 return LandingPadLabel;
753 for (
unsigned N = TyInfo.
size();
N; --
N)
760 std::vector<unsigned> IdsInFilter(TyInfo.
size());
761 for (
unsigned I = 0,
E = TyInfo.
size();
I !=
E; ++
I)
767 bool TidyIfNoBeginLabels) {
768 for (
unsigned i = 0;
i != LandingPads.size(); ) {
778 LandingPads.erase(LandingPads.begin() +
i);
782 if (TidyIfNoBeginLabels) {
783 for (
unsigned j = 0,
e = LandingPads[
i].BeginLabels.size();
j !=
e; ++
j) {
786 if ((BeginLabel->
isDefined() || (LPMap && (*LPMap)[BeginLabel] != 0)) &&
787 (EndLabel->
isDefined() || (LPMap && (*LPMap)[EndLabel] != 0)))
797 if (LandingPads[
i].BeginLabels.empty()) {
798 LandingPads.erase(LandingPads.begin() +
i);
838 LPadToCallSiteMap[Sym].append(Sites.
begin(), Sites.
end());
842 for (
unsigned i = 0,
N = TypeInfos.size();
i !=
N; ++
i)
843 if (TypeInfos[
i] == TI)
return i + 1;
845 TypeInfos.push_back(TI);
846 return TypeInfos.size();
853 for (
unsigned i : FilterEnds) {
854 unsigned j = TyIds.size();
857 if (FilterIds[--
i] != TyIds[--
j])
868 int FilterID = -(1 + FilterIds.size());
869 FilterIds.reserve(FilterIds.size() + TyIds.size() + 1);
871 FilterEnds.push_back(FilterIds.size());
872 FilterIds.push_back(0);
878 assert(
MI->isCandidateForCallSiteEntry() &&
879 "Call site info refers only to call (MI) candidates");
881 if (!
Target.Options.EmitCallSiteInfo)
882 return CallSitesInfo.
end();
883 return CallSitesInfo.
find(
MI);
893 if (BMI.isCandidateForCallSiteEntry())
900 assert(
MI->shouldUpdateCallSiteInfo() &&
901 "Call site info refers only to call (MI) candidates or "
902 "candidates inside bundles");
906 if (CSIt == CallSitesInfo.
end())
908 CallSitesInfo.
erase(CSIt);
914 "Call site info refers only to call (MI) candidates or "
915 "candidates inside bundles");
917 if (!New->isCandidateForCallSiteEntry())
922 if (CSIt == CallSitesInfo.
end())
926 CallSitesInfo[New] = CSInfo;
932 "Call site info refers only to call (MI) candidates or "
933 "candidates inside bundles");
935 if (!New->isCandidateForCallSiteEntry())
940 if (CSIt == CallSitesInfo.
end())
944 CallSitesInfo.
erase(CSIt);
945 CallSitesInfo[New] = CSInfo;
956 assert(Result.second &&
"Substitution for an already substituted value?");
961 unsigned MaxOperand) {
975 auto &NewMO = New.getOperand(
I);
978 if (!OldMO.isReg() || !OldMO.isDef())
982 unsigned NewInstrNum = New.getDebugInstrNum();
984 std::make_pair(NewInstrNum,
I));
1035 const std::vector<MachineBasicBlock*> &DestBBs) {
1036 assert(!DestBBs.empty() &&
"Cannot create an empty jump table!");
1038 return JumpTables.size()-1;
1045 assert(Old != New &&
"Not making a change?");
1046 bool MadeChange =
false;
1047 for (
size_t i = 0,
e = JumpTables.size();
i !=
e; ++
i)
1054 bool MadeChange =
false;
1056 auto removeBeginItr =
std::remove(JTE.MBBs.begin(), JTE.MBBs.end(),
MBB);
1057 MadeChange |= (removeBeginItr != JTE.MBBs.end());
1058 JTE.MBBs.erase(removeBeginItr, JTE.MBBs.end());
1068 assert(Old != New &&
"Not making a change?");
1069 bool MadeChange =
false;
1071 for (
size_t j = 0,
e = JTE.
MBBs.size();
j !=
e; ++
j)
1072 if (JTE.
MBBs[
j] == Old) {
1080 if (JumpTables.empty())
return;
1082 OS <<
"Jump Tables:\n";
1084 for (
unsigned i = 0,
e = JumpTables.size();
i !=
e; ++
i) {
1086 for (
unsigned j = 0,
f = JumpTables[
i].MBBs.size();
j !=
f; ++
j)
1095 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
1107 void MachineConstantPoolValue::anchor() {}
1110 return DL.getTypeAllocSize(Ty);
1115 return Val.MachineCPVal->getSizeInBytes(
DL);
1116 return DL.getTypeAllocSize(
Val.ConstVal->getType());
1122 return Val.ConstVal->needsDynamicRelocation();
1148 if (
Constants[
i].isMachineConstantPoolEntry()) {
1163 if (
A ==
B)
return true;
1167 if (
A->getType() ==
B->getType())
return false;
1170 if (isa<StructType>(
A->getType()) || isa<ArrayType>(
A->getType()) ||
1171 isa<StructType>(
B->getType()) || isa<ArrayType>(
B->getType()))
1175 uint64_t StoreSize =
DL.getTypeStoreSize(
A->getType());
1176 if (StoreSize !=
DL.getTypeStoreSize(
B->getType()) || StoreSize > 128)
1185 if (isa<PointerType>(
A->getType()))
1188 else if (
A->getType() != IntTy)
1191 if (isa<PointerType>(
B->getType()))
1194 else if (
B->getType() != IntTy)
1205 if (Alignment > PoolAlignment) PoolAlignment = Alignment;
1211 if (!
Constants[
i].isMachineConstantPoolEntry() &&
1224 if (Alignment > PoolAlignment) PoolAlignment = Alignment;
1231 MachineCPVsSharingEntries.insert(V);
1232 return (
unsigned)Idx;
1242 OS <<
"Constant Pool:\n";
1244 OS <<
" cp#" <<
i <<
": ";
1245 if (
Constants[
i].isMachineConstantPoolEntry())
1248 Constants[
i].Val.ConstVal->printAsOperand(OS,
false);
1249 OS <<
", align=" <<
Constants[
i].getAlign().value();
1254 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
void addLiveIn(MCRegister Reg, Register vreg=Register())
addLiveIn - Add the specified register as a live-in.
std::string getNodeLabel(const MachineBasicBlock *Node, const MachineFunction *Graph)
static SectionKind getReadOnlyWithRel()
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
bool isNull() const
Test if the pointer held in the union is null, regardless of which type it is.
unsigned getConstantPoolIndex(const Constant *C, Align Alignment)
getConstantPoolIndex - Create a new entry in the constant pool or return an existing one.
bool RemoveMBBFromJumpTables(MachineBasicBlock *MBB)
RemoveMBBFromJumpTables - If MBB is present in any jump tables, remove it.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
unsigned createJumpTableIndex(const std::vector< MachineBasicBlock * > &DestBBs)
createJumpTableIndex - Create a new jump table.
A parsed version of the target data layout string in and methods for querying it.
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
Register createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
std::pair< unsigned, unsigned > DebugInstrOperandPair
Pair of instruction number and operand number.
uint32_t * allocateRegMask()
Allocate and initialize a register mask with NumRegister bits.
void print(raw_ostream &OS) const
Print the MachineFunctionProperties in human-readable form.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Context object for machine code objects.
MCContext & getContext() const
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
void assignBeginEndSections()
Assign IsBeginSection IsEndSection fields for basic blocks in this function.
A raw_ostream that writes to an std::string.
Target - Wrapper for Target specific information.
MaybeAlign getFnStackAlign() const
Return the stack alignment for the function.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
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)
Align getPrefFunctionAlignment() const
Return the preferred function alignment.
MCSymbol * LandingPadLabel
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, uint64_t s, Align base_alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
int64_t getOffset() const
For normal values, this is a byte offset added to the base address.
Printable printMBBReference(const MachineBasicBlock &MBB)
Prints a machine basic block reference.
bool livein_empty() const
SmallVector< SEHHandler, 1 > SEHHandlers
void copyCallSiteInfo(const MachineInstr *Old, const MachineInstr *New)
Copy the call site info from Old to \ New.
unsigned getNumRegs() const
Return the number of registers this target has (useful for sizing arrays holding per register informa...
MachineJumpTableInfo * getOrCreateJumpTableInfo(unsigned JTEntryKind)
getOrCreateJumpTableInfo - Get the JumpTableInfo for this function, if it does already exist,...
unsigned getFunctionNumber() const
getFunctionNumber - Return a unique ID for the current function.
void bundleWithPred()
Bundle this instruction with its predecessor.
const MachineBasicBlock & back() const
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
bool erase(const KeyT &Val)
bool hasDebugInfo() const
Returns true if valid debug info is present.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
void moveCallSiteInfo(const MachineInstr *Old, const MachineInstr *New)
Move the call site info from Old to \New call site info.
Abstract base class for all machine specific constantpool value subclasses.
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
virtual void MF_HandleRemoval(MachineInstr &MI)=0
Callback before a removal. This should not modify the MI directly.
The instances of the Type class are immutable: once they are created, they are never changed.
bool isDefined() const
isDefined - Check if this symbol is defined (i.e., it has an address).
static SectionKind getMergeableConst16()
A description of a memory reference used in the backend.
Register getLiveInVirtReg(MCRegister PReg) const
getLiveInVirtReg - If PReg is a live-in physical register, return the corresponding live-in physical ...
OutputIt copy(R &&Range, OutputIt Out)
void setCallSiteLandingPad(MCSymbol *Sym, ArrayRef< unsigned > Sites)
Map the landing pad's EH symbol to the call site indexes.
@ EK_BlockAddress
EK_BlockAddress - Each entry is a plain address of block, e.g.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
static unsigned getFnStackAlignment(const TargetSubtargetInfo *STI, const Function &F)
unsigned peekDebugInstrNum() const
Examine the instruction number of this MachineInstr.
void addSEHCatchHandler(MachineBasicBlock *LandingPad, const Function *Filter, const BlockAddress *RecoverBA)
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
void ViewGraph(const GraphType &G, const Twine &Name, bool ShortNames=false, const Twine &Title="", GraphProgram::Name Program=GraphProgram::DOT)
ViewGraph - Emit a dot graph, run 'dot', run gv on the postscript file, then cleanup.
void incorporateFunction(const Function &F)
Incorporate the given function.
MCSymbol * getJTISymbol(unsigned JTI, MCContext &Ctx, bool isLinkerPrivate=false) const
getJTISymbol - Return the MCSymbol for the specified non-empty jump table.
AAMDNodes getAAInfo() const
Return the AA tags for the memory reference.
@ EK_Custom32
EK_Custom32 - Each entry is a 32-bit value that is custom lowered by the TargetLowering::LowerCustomJ...
std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
Manage lifetime of a slot tracker for printing IR.
unsigned const TargetRegisterInfo * TRI
const Function * FilterOrFinally
Filter or finally function. Null indicates a catch-all.
static const char * getPropertyName(MachineFunctionProperties::Property Prop)
BasicBlockListType::iterator iterator
iterator erase(iterator where)
LLVM Basic Block Representation.
unsigned getEntrySize(const DataLayout &TD) const
getEntrySize - Return the size of each entry in the jump table.
MachineBasicBlock::instr_iterator getBundleEnd(MachineBasicBlock::instr_iterator I)
Returns an iterator pointing beyond the bundle containing I.
bool ReplaceMBBInJumpTables(MachineBasicBlock *Old, MachineBasicBlock *New)
ReplaceMBBInJumpTables - If Old is the target of any jump tables, update the jump tables to branch to...
JTEntryKind getEntryKind() const
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void dump() const
dump - Call to stderr.
EHPersonality classifyEHPersonality(const Value *Pers)
See if the given exception handling personality function is one that we understand.
static SectionKind getReadOnly()
const MachinePointerInfo & getPointerInfo() const
void substituteDebugValuesForInst(const MachineInstr &Old, MachineInstr &New, unsigned MaxOperand=UINT_MAX)
Create substitutions for any tracked values in Old, to point at New.
bool contains(Register Reg) const
Return true if the specified register is included in this register class.
< i1 > br i1 label label bb bb
const MachineBasicBlock & front() const
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ATTRIBUTE_RETURNS_NOALIAS void * Allocate(size_t Size, Align Alignment)
Allocate space at the specified alignment.
Align getBaseAlign() const
Return the minimum known alignment in bytes of the base address, without the offset.
SmallVector< MCSymbol *, 1 > EndLabels
Itanium Name Demangler i e convert the string _Z1fv into f()". You can also use the CRTP base ManglingParser to perform some simple analysis on the mangled name
void ensureMaxAlignment(Align Alignment)
Make sure the function is at least Align bytes aligned.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static unsigned getRegMaskSize(unsigned NumRegs)
Returns number of elements needed for a regmask array.
Constant * ConstantFoldCastOperand(unsigned Opcode, Constant *C, Type *DestTy, const DataLayout &DL)
Attempt to constant fold a cast with the specified operand.
const Value * getValue() const
Return the base address of the memory access.
Align getStackAlign() const
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligne...
(vector float) vec_cmpeq(*A, *B) C
const MachineOperand & getOperand(unsigned i) const
DenormalMode getDenormalMode(const fltSemantics &FPType) const
Returns the denormal handling type for the default rounding mode of the function.
unsigned ForceDwarfFrameSection
Emit DWARF debug frame section.
void addCatchTypeInfo(MachineBasicBlock *LandingPad, ArrayRef< const GlobalValue * > TyInfo)
Provide the catch typeinfo for a landing pad.
Align getMinFunctionAlignment() const
Return the minimum function alignment.
Align getABIIntegerTypeAlignment(unsigned BitWidth) const
Returns the minimum ABI-required alignment for an integer type of the specified bitwidth.
void DeleteMachineInstr(MachineInstr *MI)
DeleteMachineInstr - Delete the given MachineInstr.
std::vector< MachineBasicBlock * > MBBs
MBBs - The vector of basic blocks from which to create the jump table.
void print(const MachineFunction &MF, raw_ostream &OS) const
Used by the MachineFunction printer to print information about stack objects.
virtual ~MachineFunctionInfo()
const MachineFunctionProperties & getProperties() const
Get the function properties.
std::vector< int > TypeIds
void setDebugInstrNumberingCount(unsigned Num)
Set value of DebugInstrNumberingCount field.
SectionKind getSectionKind(const DataLayout *DL) const
unsigned getTypeIDFor(const GlobalValue *TI)
Return the type id for the specified typeinfo. This is function wide.
Describe properties that are true of each instruction in the target description file.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
MachineFunctionProperties & set(Property P)
This class contains meta information specific to a module.
bool shouldUpdateCallSiteInfo() const
Return true if copying, moving, or erasing this instruction requires updating Call Site Info (see cop...
bool isStackRealignable() const
isStackRealignable - This method returns whether the stack can be realigned.
void viewCFG() const
viewCFG - This function is meant for use from the debugger.
This class implements an extremely fast bulk output stream that can only output to a stream.
bool hasPersonalityFn() const
Check whether this function has a personality function.
void makeDebugValueSubstitution(DebugInstrOperandPair, DebugInstrOperandPair)
Create a substitution between one <instr,operand> value to a different, new value.
bool shouldSplitStack() const
Should we be emitting segmented stack stuff for the function.
void addFilterTypeInfo(MachineBasicBlock *LandingPad, ArrayRef< const GlobalValue * > TyInfo)
Provide the filter typeinfo for a landing pad.
Printable printJumpTableEntryReference(unsigned Idx)
Prints a jump table entry reference.
livein_iterator livein_begin() const
static bool CanShareConstantPoolEntry(const Constant *A, const Constant *B, const DataLayout &DL)
Test whether the given two constants can be allocated the same constant pool entry.
const Instruction * getFirstNonPHI() const
Returns a pointer to the first instruction in this block that is not a PHINode instruction.
This struct is a compact representation of a valid (non-zero power of two) alignment.
SyncScope::ID getSyncScopeID() const
Returns the synchronization scope ID for this memory operation.
void tidyLandingPads(DenseMap< MCSymbol *, uintptr_t > *LPMap=nullptr, bool TidyIfNoBeginLabels=true)
Remap landing pad labels and remove any deleted landing pads.
void addInvoke(MachineBasicBlock *LandingPad, MCSymbol *BeginLabel, MCSymbol *EndLabel)
Provide the begin and end labels of an invoke style call and associate it with a try landing pad bloc...
static const MachineInstr * getCallInstr(const MachineInstr *MI)
Return the call machine instruction or find a call within bundle.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
void viewCFGOnly() const
viewCFGOnly - This function is meant for use from the debugger.
@ EK_LabelDifference32
EK_LabelDifference32 - Each entry is the address of the block minus the address of the jump table.
DOTGraphTraits - Template class that can be specialized to customize how graphs are converted to 'dot...
const TargetRegisterClass * getRegClass(Register Reg) const
Return the register class of the specified virtual register.
static std::string getGraphName(const MachineFunction *F)
MachineModuleInfo & getMMI() const
void deallocateOperandArray(OperandCapacity Cap, MachineOperand *Array)
Dellocate an array of MachineOperands and recycle the memory.
Implements a dense probed hash-table based set.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
AtomicOrdering
Atomic ordering for LLVM's memory model.
@ EK_GPRel64BlockAddress
EK_GPRel64BlockAddress - Each entry is an address of block, encoded with a relocation as gp-relative,...
This is an important base class in LLVM.
virtual unsigned getSizeInBytes(const DataLayout &DL) const
SmallVector< MCSymbol *, 1 > BeginLabels
Representation of each machine instruction.
MachineInstr::ExtraInfo * createMIExtraInfo(ArrayRef< MachineMemOperand * > MMOs, MCSymbol *PreInstrSymbol=nullptr, MCSymbol *PostInstrSymbol=nullptr, MDNode *HeapAllocMarker=nullptr)
Allocate and construct an extra info structure for a MachineInstr.
Module * getParent()
Get the module that this global value is contained inside of...
void addSEHCleanupHandler(MachineBasicBlock *LandingPad, const Function *Cleanup)
MachineInstr * CloneMachineInstr(const MachineInstr *Orig)
Create a new MachineInstr which is a copy of Orig, identical in all ways except the instruction has n...
multiplies can be turned into SHL s
This class contains a discriminated union of information about pointers in memory operands,...
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
void dump() const
dump - Print the current MachineFunction to cerr, useful for debugger use.
bool isScopedEHPersonality(EHPersonality Pers)
Returns true if this personality uses scope-style EH IR instructions: catchswitch,...
Represent subnormal handling kind for floating point instruction inputs and outputs.
initializer< Ty > init(const Ty &Val)
JTEntryKind
JTEntryKind - This enum indicates how each entry of the jump table is represented and emitted.
MachineBasicBlock * CreateMachineBasicBlock(const BasicBlock *bb=nullptr)
CreateMachineBasicBlock - Allocate a new MachineBasicBlock.
void setIsEndSection(bool V=true)
iterator find(const_arg_type_t< KeyT > Val)
Flags
Flags values. These may be or'd together.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isMachineConstantPoolEntry() const
isMachineConstantPoolEntry - Return true if the MachineConstantPoolEntry is indeed a target specific ...
MachineBasicBlock * LandingPadBlock
Align getPointerABIAlignment(unsigned AS) const
Layout pointer alignment.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
std::map< DebugInstrOperandPair, DebugInstrOperandPair > DebugValueSubstitutions
Substitution map: from one <inst,operand> pair to another.
MachinePointerInfo getWithOffset(int64_t O) const
void clear(AllocatorType &Allocator)
Release all the tracked allocations to the allocator.
bool needsRelocation() const
This method classifies the entry according to whether or not it may generate a relocation entry.
Register addLiveIn(MCRegister PReg, const TargetRegisterClass *RC)
addLiveIn - Add the specified physical register as a live-in value and create a corresponding virtual...
std::error_code remove(const Twine &path, bool IgnoreNonExisting=true)
Remove path.
The address of a basic block.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
PointerUnion< const Value *, const PseudoSourceValue * > V
This is the IR pointer value for the access, or it is null if unknown.
Expected< ExpressionValue > min(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
void DeleteMachineBasicBlock(MachineBasicBlock *MBB)
DeleteMachineBasicBlock - Delete the given MachineBasicBlock.
ArrayRef< int > allocateShuffleMask(ArrayRef< int > Mask)
StringRef - Represent a constant reference to a string, i.e.
MachineBasicBlock MachineBasicBlock::iterator MBBI
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static const Function * getParent(const Value *V)
MachineBasicBlock::instr_iterator getBundleStart(MachineBasicBlock::instr_iterator I)
Returns an iterator to the first instruction in the bundle containing I.
void append_range(Container &C, Range &&R)
Wrapper function to append a range to a container.
self_iterator getIterator()
void print(raw_ostream &OS) const
print - Used by the MachineFunction printer to print information about jump tables.
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
bool ReplaceMBBInJumpTable(unsigned Idx, MachineBasicBlock *Old, MachineBasicBlock *New)
ReplaceMBBInJumpTable - If Old is a target of the jump tables, update the jump table to branch to New...
MachineFunctionProperties & reset(Property P)
StringRef getName() const
Return a constant reference to the value's name.
MCSymbol * createTempSymbol()
Create a temporary symbol with a unique name.
TargetSubtargetInfo - Generic base class for all target subtargets.
MBBSectionID getSectionID() const
Returns the section ID of this basic block.
unsigned DebugInstrNumberingCount
A count of how many instructions in the function have had numbers assigned to them.
DenormalMode getDenormalMode(const fltSemantics &FPType) const
Returns the denormal handling type for the default rounding mode of the function.
MachineInstr & CloneMachineInstrBundle(MachineBasicBlock &MBB, MachineBasicBlock::iterator InsertBefore, const MachineInstr &Orig)
Clones instruction or the whole instruction bundle Orig and insert into MBB before InsertBefore.
unsigned const MachineRegisterInfo * MRI
const Value * stripPointerCasts() const
Strip off pointer casts, all-zero GEPs and address space casts.
Wrapper class representing virtual and physical registers.
int getFilterIDFor(std::vector< unsigned > &TyIds)
Return the id of the filter encoded by TyIds. This is function wide.
static SectionKind getMergeableConst8()
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Align commonAlignment(Align A, Align B)
Returns the alignment that satisfies both alignments.
SectionKind - This is a simple POD value that classifies the properties of a section.
This class is a data container for one entry in a MachineConstantPool.
Function & getFunction()
Return the LLVM function that this machine code represents.
virtual const TargetFrameLowering * getFrameLowering() const
bool needsFrameMoves() const
True if this function needs frame moves for debug or exceptions.
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
instr_iterator insert(instr_iterator I, MachineInstr *M)
Insert MI into the instruction list before I, possibly inside a bundle.
Iterator for intrusive lists based on ilist_node.
uint64_t value() const
This is a hole in the type system and should not be abused.
uint64_t getSize() const
Return the size in bytes of the memory reference.
@ EK_Inline
EK_Inline - Jump table entries are emitted inline at their point of use.
void setIsBeginSection(bool V=true)
std::vector< std::pair< MCRegister, Register > >::const_iterator livein_iterator
void print(raw_ostream &OS, const SlotIndexes *=nullptr) const
print - Print out the MachineFunction in a format suitable for debugging to the specified stream.
MachineJumpTableEntry - One jump table in the jump table info.
#define LLVM_NODISCARD
LLVM_NODISCARD - Warn if a type or return value is discarded.
bool needsUnwindTableEntry() const
True if this function needs an unwind table.
This class describes a target machine that is implemented with the LLVM target-independent code gener...
MachineFunction(Function &F, const LLVMTargetMachine &Target, const TargetSubtargetInfo &STI, unsigned FunctionNum, MachineModuleInfo &MMI)
static bool isSimple(Instruction *I)
Constant * getPersonalityFn() const
Get the personality function associated with this function.
void addCleanup(MachineBasicBlock *LandingPad)
Add a cleanup action for a landing pad.
void print(raw_ostream &OS) const
print - Used by the MachineFunction printer to print information about constant pool objects.
bool getAlign(const Function &F, unsigned index, unsigned &align)
MCSymbol * getPICBaseSymbol() const
getPICBaseSymbol - Return a function-local symbol to represent the PIC base.
LLVM_NODISCARD unsigned addFrameInst(const MCCFIInstruction &Inst)
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
virtual const TargetLowering * getTargetLowering() const
union llvm::MachineConstantPoolEntry::@176 Val
The constant itself.
static void deleteNode(NodeTy *V)
virtual int getExistingMachineCPValue(MachineConstantPool *CP, Align Alignment)=0
Simple wrapper around std::function<void(raw_ostream&)>.
void addPersonality(const Function *Personality)
Provide the personality function for the exception information.
static SectionKind getMergeableConst4()
unsigned getNumOperands() const
Retuns the total number of operands.
size_t size() const
size - Get the array size.
Align max(MaybeAlign Lhs, Align Rhs)
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
A raw_ostream that writes to an SmallVector or SmallString.
@ EK_GPRel32BlockAddress
EK_GPRel32BlockAddress - Each entry is an address of block, encoded with a relocation as gp-relative,...
DefaultDOTGraphTraits - This class provides the default implementations of all of the DOTGraphTraits ...
AtomicOrdering getFailureOrdering() const
For cmpxchg atomic operations, return the atomic ordering requirements when store does not occur.
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
This structure is used to retain landing pad info for the current function.
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
bool hasSubClassEq(const TargetRegisterClass *RC) const
Returns true if RC is a sub-class of or equal to this class.
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
const char * createExternalSymbolName(StringRef Name)
Allocate a string and populate it with the given external symbol name.
unsigned getEntryAlignment(const DataLayout &TD) const
getEntryAlignment - Return the alignment of each entry in the jump table.
AtomicOrdering getOrdering() const
Return the atomic ordering requirements for this memory operation.
MachineInstr * CreateMachineInstr(const MCInstrDesc &MCID, const DebugLoc &DL, bool NoImplicit=false)
CreateMachineInstr - Allocate a new MachineInstr.
MCSymbol * addLandingPad(MachineBasicBlock *LandingPad)
Add a new panding pad, and extract the exception handling information from the landingpad instruction...
static SectionKind getMergeableConst32()
const MDNode * getRanges() const
Return the range tag for the memory reference.
void dump() const
dump - Call print(cerr) to be called from the debugger.
Printable printReg(Register Reg, const TargetRegisterInfo *TRI=nullptr, unsigned SubIdx=0, const MachineRegisterInfo *MRI=nullptr)
Prints virtual and physical registers with or without a TRI instance.
void eraseCallSiteInfo(const MachineInstr *MI)
Following functions update call site info.
VariableDbgInfoMapTy VariableDbgInfos
livein_iterator livein_end() const
const BlockAddress * RecoverBA
Address of block to recover at. Null for a finally handler.
DOTGraphTraits(bool isSimple=false)
LLVM Value Representation.
Flags getFlags() const
Return the raw flags of the source value,.
void Deallocate(const void *Ptr, size_t Size, size_t)
void RenumberBlocks(MachineBasicBlock *MBBFrom=nullptr)
RenumberBlocks - This discards all of the MachineBasicBlock numbers and recomputes them.
LandingPadInfo & getOrCreateLandingPadInfo(MachineBasicBlock *LandingPad)
Find or create an LandingPadInfo for the specified MachineBasicBlock.
bool isFuncletEHPersonality(EHPersonality Pers)
Returns true if this is a personality function that invokes handler funclets (which must return to it...
unsigned getPointerSize(unsigned AS=0) const
Layout pointer size FIXME: The defaults need to be removed once all of the backends/clients are updat...
unsigned getSizeInBytes(const DataLayout &DL) const
A Use represents the edge between a Value definition and its users.
Wrapper class representing physical registers. Should be passed by value.
const PseudoSourceValue * getPseudoValue() const
virtual void MF_HandleInsertion(MachineInstr &MI)=0
Callback after an insertion. This should not modify the MI directly.