42 #include "llvm/Config/llvm-config.h" 79 #define DEBUG_TYPE "codegen" 83 cl::desc(
"Force the alignment of all functions."),
90 case P::FailedISel:
return "FailedISel";
91 case P::IsSSA:
return "IsSSA";
92 case P::Legalized:
return "Legalized";
93 case P::NoPHIs:
return "NoPHIs";
94 case P::NoVRegs:
return "NoVRegs";
95 case P::RegBankSelected:
return "RegBankSelected";
96 case P::Selected:
return "Selected";
97 case P::TracksLiveness:
return "TracksLiveness";
103 const char *Separator =
"";
107 OS << Separator << getPropertyName(static_cast<Property>(
I));
133 : F(F), Target(Target), STI(&STI), Ctx(mmi.getContext()), MMI(mmi) {
134 FunctionNumber = FunctionNum;
138 void MachineFunction::init() {
172 JumpTableInfo =
nullptr;
185 "Can't create a MachineFunction using a Module with a " 186 "Target-incompatible DataLayout attached\n");
189 llvm::make_unique<PseudoSourceValueManager>(*(
getSubtarget().
197 void MachineFunction::clear() {
204 I->Insts.clearAndLeakNodesUnsafely();
205 MBBNumbering.clear();
207 InstructionRecycler.clear(Allocator);
208 OperandRecycler.
clear(Allocator);
209 BasicBlockRecycler.clear(Allocator);
210 CodeViewAnnotations.clear();
213 RegInfo->~MachineRegisterInfo();
221 FrameInfo->~MachineFrameInfo();
228 JumpTableInfo->~MachineJumpTableInfo();
233 WinEHInfo->~WinEHFuncInfo();
246 if (JumpTableInfo)
return JumpTableInfo;
248 JumpTableInfo =
new (Allocator)
250 return JumpTableInfo;
263 if (
empty()) { MBBNumbering.clear();
return; }
271 unsigned BlockNo = 0;
273 BlockNo = std::prev(MBBI)->getNumber() + 1;
275 for (; MBBI !=
E; ++MBBI, ++BlockNo) {
276 if (MBBI->getNumber() != (int)BlockNo) {
278 if (MBBI->getNumber() != -1) {
279 assert(MBBNumbering[MBBI->getNumber()] == &*MBBI &&
280 "MBB number mismatch!");
281 MBBNumbering[MBBI->getNumber()] =
nullptr;
285 if (MBBNumbering[BlockNo])
286 MBBNumbering[BlockNo]->setNumber(-1);
288 MBBNumbering[BlockNo] = &*MBBI;
289 MBBI->setNumber(BlockNo);
295 assert(BlockNo <= MBBNumbering.size() &&
"Mismatch!");
296 MBBNumbering.resize(BlockNo);
303 return new (InstructionRecycler.Allocate<
MachineInstr>(Allocator))
311 return new (InstructionRecycler.Allocate<
MachineInstr>(Allocator))
321 MBB.
insert(InsertBefore, Cloned);
322 if (FirstClone ==
nullptr) {
328 if (!I->isBundledWithSucc())
348 InstructionRecycler.Deallocate(Allocator, MI);
363 MBB->~MachineBasicBlock();
364 BasicBlockRecycler.Deallocate(Allocator, MBB);
369 unsigned base_alignment,
const AAMDNodes &AAInfo,
const MDNode *Ranges,
372 return new (Allocator)
374 SSID, Ordering, FailureOrdering);
381 return new (Allocator)
387 return new (Allocator)
402 return new (Allocator)
414 std::pair<MachineInstr::mmo_iterator, MachineInstr::mmo_iterator>
427 if ((*I)->isLoad()) {
428 if (!(*I)->isStore())
436 (*I)->
getSize(), (*I)->getBaseAlignment(),
437 (*I)->getAAInfo(),
nullptr,
438 (*I)->getSyncScopeID(), (*I)->getOrdering(),
439 (*I)->getFailureOrdering());
440 Result[
Index] = JustLoad;
445 return std::make_pair(Result, Result + Num);
448 std::pair<MachineInstr::mmo_iterator, MachineInstr::mmo_iterator>
461 if ((*I)->isStore()) {
470 (*I)->
getSize(), (*I)->getBaseAlignment(),
471 (*I)->getAAInfo(),
nullptr,
472 (*I)->getSyncScopeID(), (*I)->getOrdering(),
473 (*I)->getFailureOrdering());
474 Result[
Index] = JustStore;
479 return std::make_pair(Result, Result + Num);
485 Dest[Name.
size()] = 0;
493 memset(Mask, 0, Size *
sizeof(Mask[0]));
497 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) 508 OS <<
"# Machine code for function " <<
getName() <<
": ";
513 FrameInfo->
print(*
this, OS);
517 JumpTableInfo->
print(OS);
525 OS <<
"Function Live Ins: ";
530 OS <<
" in " <<
printReg(
I->second, TRI);
531 if (std::next(
I) !=
E)
539 for (
const auto &BB : *
this) {
542 BB.print(OS, MST, Indexes,
true);
545 OS <<
"\n# End machine code for function " <<
getName() <<
".\n\n";
555 return (
"CFG for '" + F->
getName() +
"' function").str();
567 OSS <<
": " << BB->getName();
572 if (OutStr[0] ==
'\n') OutStr.erase(OutStr.begin());
575 for (
unsigned i = 0; i != OutStr.length(); ++i)
576 if (OutStr[i] ==
'\n') {
578 OutStr.insert(OutStr.begin()+i+1,
'l');
591 errs() <<
"MachineFunction::viewCFG is only available in debug builds on " 592 <<
"systems with Graphviz or gv!\n";
601 errs() <<
"MachineFunction::viewCFGOnly is only available in debug builds on " 602 <<
"systems with Graphviz or gv!\n";
622 "Register class mismatch!");
634 bool isLinkerPrivate)
const {
636 assert(JumpTableInfo &&
"No jump tables");
637 assert(JTI < JumpTableInfo->getJumpTables().
size() &&
"Invalid JTI!");
659 unsigned N = LandingPads.size();
660 for (
unsigned i = 0; i <
N; ++i) {
667 return LandingPads[
N];
678 MCSymbol *LandingPadLabel = Ctx.createTempSymbol();
681 return LandingPadLabel;
687 for (
unsigned N = TyInfo.
size();
N; --
N)
694 std::vector<unsigned> IdsInFilter(TyInfo.
size());
695 for (
unsigned I = 0,
E = TyInfo.
size();
I !=
E; ++
I)
701 for (
unsigned i = 0; i != LandingPads.size(); ) {
711 LandingPads.erase(LandingPads.begin() + i);
715 for (
unsigned j = 0, e = LandingPads[i].BeginLabels.size(); j != e; ++j) {
719 (LPMap && (*LPMap)[BeginLabel] != 0)) &&
721 (LPMap && (*LPMap)[EndLabel] != 0)))
continue;
730 if (LandingPads[i].BeginLabels.empty()) {
731 LandingPads.erase(LandingPads.begin() + i);
770 LPadToCallSiteMap[Sym].append(Sites.
begin(), Sites.
end());
774 for (
unsigned i = 0,
N = TypeInfos.size(); i !=
N; ++i)
775 if (TypeInfos[i] == TI)
return i + 1;
777 TypeInfos.push_back(TI);
778 return TypeInfos.size();
785 for (std::vector<unsigned>::iterator
I = FilterEnds.begin(),
786 E = FilterEnds.end();
I !=
E; ++
I) {
787 unsigned i = *
I, j = TyIds.size();
790 if (FilterIds[--i] != TyIds[--j])
801 int FilterID = -(1 + FilterIds.size());
802 FilterIds.reserve(FilterIds.size() + TyIds.size() + 1);
803 FilterIds.insert(FilterIds.end(), TyIds.begin(), TyIds.end());
804 FilterEnds.push_back(FilterIds.size());
805 FilterIds.push_back(0);
811 if (
const auto *PF = dyn_cast<Function>(
828 Constant *CVal = cast<Constant>(Val);
832 FilterList.
push_back(cast<GlobalValue>((*II)->stripPointerCasts()));
849 switch (getEntryKind()) {
869 switch (getEntryKind()) {
886 const std::vector<MachineBasicBlock*> &DestBBs) {
887 assert(!DestBBs.empty() &&
"Cannot create an empty jump table!");
889 return JumpTables.size()-1;
896 assert(Old != New &&
"Not making a change?");
897 bool MadeChange =
false;
898 for (
size_t i = 0, e = JumpTables.size(); i != e; ++i)
899 ReplaceMBBInJumpTable(i, Old, New);
908 assert(Old != New &&
"Not making a change?");
909 bool MadeChange =
false;
911 for (
size_t j = 0, e = JTE.
MBBs.size(); j != e; ++j)
912 if (JTE.
MBBs[j] == Old) {
920 if (JumpTables.empty())
return;
922 OS <<
"Jump Tables:\n";
924 for (
unsigned i = 0, e = JumpTables.size(); i != e; ++i) {
926 for (
unsigned j = 0, f = JumpTables[i].MBBs.size(); j != f; ++j)
933 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) 945 void MachineConstantPoolValue::anchor() {}
948 if (isMachineConstantPoolEntry())
949 return Val.MachineCPVal->getType();
950 return Val.ConstVal->getType();
954 if (isMachineConstantPoolEntry())
956 return Val.ConstVal->needsRelocation();
961 if (needsRelocation())
981 for (
unsigned i = 0, e =
Constants.size(); i != e; ++i)
982 if (
Constants[i].isMachineConstantPoolEntry()) {
987 MachineCPVsSharingEntries.begin(),
E = MachineCPVsSharingEntries.end();
989 if (Deleted.
count(*
I) == 0)
999 if (A == B)
return true;
1006 if (isa<StructType>(A->
getType()) || isa<ArrayType>(A->
getType()) ||
1021 if (isa<PointerType>(A->
getType()))
1023 const_cast<Constant *>(A), IntTy, DL);
1024 else if (A->
getType() != IntTy)
1027 if (isa<PointerType>(B->
getType()))
1029 const_cast<Constant *>(B), IntTy, DL);
1030 else if (B->
getType() != IntTy)
1040 unsigned Alignment) {
1041 assert(Alignment &&
"Alignment must be specified!");
1042 if (Alignment > PoolAlignment) PoolAlignment = Alignment;
1047 for (
unsigned i = 0, e =
Constants.size(); i != e; ++i)
1048 if (!
Constants[i].isMachineConstantPoolEntry() &&
1050 if ((
unsigned)
Constants[i].getAlignment() < Alignment)
1060 unsigned Alignment) {
1061 assert(Alignment &&
"Alignment must be specified!");
1062 if (Alignment > PoolAlignment) PoolAlignment = Alignment;
1069 MachineCPVsSharingEntries.insert(V);
1070 return (
unsigned)Idx;
1080 OS <<
"Constant Pool:\n";
1081 for (
unsigned i = 0, e =
Constants.size(); i != e; ++i) {
1082 OS <<
" cp#" << i <<
": ";
1083 if (
Constants[i].isMachineConstantPoolEntry())
1084 Constants[i].Val.MachineCPVal->print(OS);
1086 Constants[i].Val.ConstVal->printAsOperand(OS,
false);
1087 OS <<
", align=" <<
Constants[i].getAlignment();
1092 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) Constant * ConstantFoldCastOperand(unsigned Opcode, Constant *C, Type *DestTy, const DataLayout &DL)
Attempt to constant fold a cast with the specified operand.
void print(raw_ostream &OS, const SlotIndexes *=nullptr, bool IsStandalone=true) const
void bundleWithPred()
Bundle this instruction with its predecessor.
void push_back(const T &Elt)
static unsigned getRegMaskSize(unsigned NumRegs)
Returns number of elements needed for a regmask array.
A parsed version of the target data layout string in and methods for querying it. ...
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
unsigned getFnStackAlignment() const
Return the stack alignment for the function.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
bool contains(unsigned Reg) const
Return true if the specified register is included in this register class.
const TargetRegisterClass * getRegClass(unsigned Reg) const
Return the register class of the specified virtual register.
unsigned getFunctionNumber() const
getFunctionNumber - Return a unique ID for the current function.
livein_iterator livein_begin() const
bool livein_empty() const
static SectionKind getMergeableConst32()
iterator erase(iterator where)
Compute iterated dominance frontiers using a linear time algorithm.
MachineFunctionProperties & reset(Property P)
void RenumberBlocks(MachineBasicBlock *MBBFrom=nullptr)
RenumberBlocks - This discards all of the MachineBasicBlock numbers and recomputes them...
MCSymbol * addLandingPad(MachineBasicBlock *LandingPad)
Add a new panding pad. Returns the label ID for the landing pad entry.
StringRef getPrivateGlobalPrefix() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
void addLiveIn(unsigned Reg, unsigned vreg=0)
addLiveIn - Add the specified register as a live-in.
const Function * FilterOrFinally
Filter or finally function. Null indicates a catch-all.
const MachineFunctionProperties & getProperties() const
Get the function properties.
Implements a dense probed hash-table based set.
void addLandingPadInfo(const LandingPadInst &I, MachineBasicBlock &MBB)
Extract the exception handling information from the landingpad instruction and add them to the specif...
AtomicOrdering getFailureOrdering() const
For cmpxchg atomic operations, return the atomic ordering requirements when store does not occur...
unsigned addLiveIn(unsigned PReg, const TargetRegisterClass *RC)
addLiveIn - Add the specified physical register as a live-in value and create a corresponding virtual...
Describe properties that are true of each instruction in the target description file.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
EK_Inline - Jump table entries are emitted inline at their point of use.
std::string getNodeLabel(const MachineBasicBlock *Node, const MachineFunction *Graph)
void viewCFG() const
viewCFG - This function is meant for use from the debugger.
virtual const TargetLowering * getTargetLowering() const
uint64_t getSize() const
Return the size in bytes of the memory reference.
static SectionKind getMergeableConst8()
LLVMContext & getContext() const
All values hold a context through their type.
static SectionKind getMergeableConst16()
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
A raw_ostream that writes to an SmallVector or SmallString.
unsigned const TargetRegisterInfo * TRI
MachineModuleInfo & getMMI() const
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds...
MCSymbol * LandingPadLabel
Manage lifetime of a slot tracker for printing IR.
Constant * getClause(unsigned Idx) const
Get the value of the clause at index Idx.
unsigned getTypeIDFor(const GlobalValue *TI)
Return the type id for the specified typeinfo. This is function wide.
uint64_t getBaseAlignment() const
Return the minimum known alignment in bytes of the base address, without the offset.
void dump() const
dump - Print the current MachineFunction to cerr, useful for debugger use.
MachineInstr * CreateMachineInstr(const MCInstrDesc &MCID, const DebugLoc &DL, bool NoImp=false)
CreateMachineInstr - Allocate a new MachineInstr.
void DeleteMachineBasicBlock(MachineBasicBlock *MBB)
DeleteMachineBasicBlock - Delete the given MachineBasicBlock.
unsigned getPointerABIAlignment(unsigned AS) const
Layout pointer alignment.
StringRef getLinkerPrivateGlobalPrefix() const
static SectionKind getMergeableConst4()
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...
MachineJumpTableInfo * getOrCreateJumpTableInfo(unsigned JTEntryKind)
getOrCreateJumpTableInfo - Get the JumpTableInfo for this function, if it does already exist...
void print(raw_ostream &OS) const
print - Used by the MachineFunction printer to print information about jump tables.
void addSEHCatchHandler(MachineBasicBlock *LandingPad, const Function *Filter, const BlockAddress *RecoverBA)
JTEntryKind
JTEntryKind - This enum indicates how each entry of the jump table is represented and emitted...
The address of a basic block.
DOTGraphTraits(bool isSimple=false)
void addSEHCleanupHandler(MachineBasicBlock *LandingPad, const Function *Cleanup)
void print(raw_ostream &OS) const
Print the MachineFunctionProperties in human-readable form.
A description of a memory reference used in the backend.
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
SmallVector< MCSymbol *, 1 > EndLabels
Printable printMBBReference(const MachineBasicBlock &MBB)
Prints a machine basic block reference.
Printable printReg(unsigned Reg, const TargetRegisterInfo *TRI=nullptr, unsigned SubIdx=0, const MachineRegisterInfo *MRI=nullptr)
Prints virtual and physical registers with or without a TRI instance.
const MDNode * getRanges() const
Return the range tag for the memory reference.
A Use represents the edge between a Value definition and its users.
SmallVector< SEHHandler, 1 > SEHHandlers
MachineInstr & CloneMachineInstrBundle(MachineBasicBlock &MBB, MachineBasicBlock::iterator InsertBefore, const MachineInstr &Orig)
Clones instruction or the whole instruction bundle Orig and insert into MBB before InsertBefore...
This file contains the simple types necessary to represent the attributes associated with functions a...
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
std::pair< MachineInstr::mmo_iterator, MachineInstr::mmo_iterator > extractLoadMemRefs(MachineInstr::mmo_iterator Begin, MachineInstr::mmo_iterator End)
extractLoadMemRefs - Allocate an array and populate it with just the load information from the given ...
int getFilterIDFor(std::vector< unsigned > &TyIds)
Return the id of the filter encoded by TyIds. This is function wide.
void Deallocate(const void *Ptr, size_t Size)
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, uint64_t s, unsigned 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.
unsigned getNumClauses() const
Get the number of clauses for this landing pad.
AtomicOrdering
Atomic ordering for LLVM's memory model.
bool isScopedEHPersonality(EHPersonality Pers)
Returns true if this personality uses scope-style EH IR instructions: catchswitch, catchpad/ret, and cleanuppad/ret.
static bool isSimple(Instruction *I)
Context object for machine code objects.
unsigned getEntryAlignment(const DataLayout &TD) const
getEntryAlignment - Return the alignment of each entry in the jump table.
This structure is used to retain landing pad info for the current function.
AtomicOrdering getOrdering() const
Return the atomic ordering requirements for this memory operation.
Type * getType() const
All values are typed, get the type of this value.
EK_LabelDifference32 - Each entry is the address of the block minus the address of the jump table...
livein_iterator livein_end() const
virtual int getExistingMachineCPValue(MachineConstantPool *CP, unsigned Alignment)=0
static std::string getGraphName(const MachineFunction *F)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
EK_BlockAddress - Each entry is a plain address of block, e.g.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
unsigned getPrefFunctionAlignment() const
Return the preferred function alignment.
bool hasPersonalityFn() const
Check whether this function has a personality function.
This class is a data container for one entry in a MachineConstantPool.
instr_iterator insert(instr_iterator I, MachineInstr *M)
Insert MI into the instruction list before I, possibly inside a bundle.
MachineBasicBlock * CreateMachineBasicBlock(const BasicBlock *bb=nullptr)
CreateMachineBasicBlock - Allocate a new MachineBasicBlock.
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
MachineFunction(const Function &F, const TargetMachine &Target, const TargetSubtargetInfo &STI, unsigned FunctionNum, MachineModuleInfo &MMI)
const Value * getValue() const
Return the base address of the memory access.
unsigned getNumRegs() const
Return the number of registers this target has (useful for sizing arrays holding per register informa...
EK_GPRel64BlockAddress - Each entry is an address of block, encoded with a relocation as gp-relative...
initializer< Ty > init(const Ty &Val)
void print(raw_ostream &OS) const
print - Used by the MachineFunction printer to print information about constant pool objects...
The landingpad instruction holds all of the information necessary to generate correct exception handl...
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
EK_Custom32 - Each entry is a 32-bit value that is custom lowered by the TargetLowering::LowerCustomJ...
unsigned const MachineRegisterInfo * MRI
void print(const MachineFunction &MF, raw_ostream &OS) const
Used by the MachineFunction printer to print information about stack objects.
LLVM Basic Block Representation.
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...
The instances of the Type class are immutable: once they are created, they are never changed...
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
static unsigned getFnStackAlignment(const TargetSubtargetInfo *STI, const Function &F)
static cl::opt< unsigned > AlignAllFunctions("align-all-functions", cl::desc("Force the alignment of all functions."), cl::init(0), cl::Hidden)
size_t size() const
size - Get the array size.
void addPersonality(const Function *Personality)
Provide the personality function for the exception information.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
SmallVector< MCSymbol *, 1 > BeginLabels
unsigned getPointerSize(unsigned AS=0) const
Layout pointer size FIXME: The defaults need to be removed once all of the backends/clients are updat...
LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ATTRIBUTE_RETURNS_NOALIAS void * Allocate(size_t Size, size_t Alignment)
Allocate space at the specified alignment.
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.
std::pair< iterator, bool > insert(const ValueT &V)
EHPersonality classifyEHPersonality(const Value *Pers)
See if the given exception handling personality function is one that we understand.
virtual ~MachineFunctionInfo()
std::vector< int > TypeIds
const PseudoSourceValue * getPseudoValue() const
MCSymbol * getJTISymbol(unsigned JTI, MCContext &Ctx, bool isLinkerPrivate=false) const
getJTISymbol - Return the MCSymbol for the specified non-empty jump table.
SectionKind - This is a simple POD value that classifies the properties of a section.
self_iterator getIterator()
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.
Printable printJumpTableEntryReference(unsigned Idx)
Prints a jump table entry reference.
std::vector< MachineBasicBlock * > MBBs
MBBs - The vector of basic blocks from which to create the jump table.
void incorporateFunction(const Function &F)
Incorporate the given function.
void DeleteMachineInstr(MachineInstr *MI)
DeleteMachineInstr - Delete the given MachineInstr.
const Constant * stripPointerCasts() const
const Value * stripPointerCasts() const
Strip off pointer casts, all-zero GEPs, and aliases.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Abstract base class for all machine specific constantpool value subclasses.
static wasm::ValType getType(const TargetRegisterClass *RC)
This class contains a discriminated union of information about pointers in memory operands...
const char * createExternalSymbolName(StringRef Name)
Allocate a string and populate it with the given external symbol name.
void print(raw_ostream &OS, const SlotIndexes *=nullptr) const
print - Print out the MachineFunction in a format suitable for debugging to the specified stream...
unsigned getStackAlignment() const
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligne...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
bool hasSubClassEq(const TargetRegisterClass *RC) const
Returns true if RC is a sub-class of or equal to this class.
void addCleanup(MachineBasicBlock *LandingPad)
Add a cleanup action for a landing pad.
DOTGraphTraits - Template class that can be specialized to customize how graphs are converted to 'dot...
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
Iterator for intrusive lists based on ilist_node.
bool isFuncletEHPersonality(EHPersonality Pers)
Returns true if this is a personality function that invokes handler funclets (which must return to it...
bool shouldSplitStack() const
Should we be emitting segmented stack stuff for the function.
MachineInstr * CloneMachineInstr(const MachineInstr *Orig)
Create a new MachineInstr which is a copy of Orig, identical in all ways except the instruction has n...
bool ReplaceMBBInJumpTables(MachineBasicBlock *Old, MachineBasicBlock *New)
ReplaceMBBInJumpTables - If Old is the target of any jump tables, update the jump tables to branch to...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Module.h This file contains the declarations for the Module class.
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
static SectionKind getReadOnlyWithRel()
unsigned getABIIntegerTypeAlignment(unsigned BitWidth) const
Returns the minimum ABI-required alignment for an integer type of the specified bitwidth.
void addCatchTypeInfo(MachineBasicBlock *LandingPad, ArrayRef< const GlobalValue *> TyInfo)
Provide the catch typeinfo for a landing pad.
uint32_t * allocateRegMask()
Allocate and initialize a register mask with NumRegister bits.
void clear(AllocatorType &Allocator)
Release all the tracked allocations to the allocator.
static void deleteNode(NodeTy *V)
const Function & getFunction() const
Return the LLVM function that this machine code represents.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void setCallSiteLandingPad(MCSymbol *Sym, ArrayRef< unsigned > Sites)
Map the landing pad's EH symbol to the call site indexes.
bool isDefined() const
isDefined - Check if this symbol is defined (i.e., it has an address).
Target - Wrapper for Target specific information.
unsigned getEntrySize(const DataLayout &TD) const
getEntrySize - Return the size of each entry in the jump table.
bool isCleanup() const
Return 'true' if this landingpad instruction is a cleanup.
MachineJumpTableEntry - One jump table in the jump table info.
MachineBasicBlock * LandingPadBlock
Flags
Flags values. These may be or'd together.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
MachineFunctionProperties & set(Property P)
TargetSubtargetInfo - Generic base class for all target subtargets.
uint64_t getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
static const char * getPropertyName(MachineFunctionProperties::Property Prop)
Representation of each machine instruction.
std::vector< std::pair< unsigned, unsigned > >::const_iterator livein_iterator
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
void ensureMaxAlignment(unsigned Align)
Make sure the function is at least Align bytes aligned.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
StringRef getName() const
Return a constant reference to the value's name.
const Function * getParent() const
Return the enclosing method, or null if none.
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
bool isCatch(unsigned Idx) const
Return 'true' if the clause and index Idx is a catch clause.
Flags getFlags() const
Return the raw flags of the source value,.
virtual const TargetFrameLowering * getFrameLowering() const
SectionKind getSectionKind(const DataLayout *DL) const
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
size_type size() const
size - Returns the number of bits in this bitvector.
size_type count(const_arg_type_t< ValueT > V) const
Return 1 if the specified key is in the set, 0 otherwise.
void viewCFGOnly() const
viewCFGOnly - This function is meant for use from the debugger.
void dump() const
dump - Call print(cerr) to be called from the debugger.
bool isStackRealignable() const
isStackRealignable - This method returns whether the stack can be realigned.
std::pair< MachineInstr::mmo_iterator, MachineInstr::mmo_iterator > extractStoreMemRefs(MachineInstr::mmo_iterator Begin, MachineInstr::mmo_iterator End)
extractStoreMemRefs - Allocate an array and populate it with just the store information from the give...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
unsigned getMinFunctionAlignment() const
Return the minimum function alignment.
A raw_ostream that writes to an std::string.
LandingPadInfo & getOrCreateLandingPadInfo(MachineBasicBlock *LandingPad)
Find or create an LandingPadInfo for the specified MachineBasicBlock.
int64_t getOffset() const
For normal values, this is a byte offset added to the base address.
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
Constant * getPersonalityFn() const
Get the personality function associated with this function.
void deallocateOperandArray(OperandCapacity Cap, MachineOperand *Array)
Dellocate an array of MachineOperands and recycle the memory.
uint64_t getTypeStoreSize(Type *Ty) const
Returns the maximum number of bytes that may be overwritten by storing the specified type...
SyncScope::ID getSyncScopeID() const
Returns the synchronization scope ID for this memory operation.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
MCSymbol * getPICBaseSymbol() const
getPICBaseSymbol - Return a function-local symbol to represent the PIC base.
const BlockAddress * RecoverBA
Address of block to recover at. Null for a finally handler.
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
static const Function * getParent(const Value *V)
This class implements an extremely fast bulk output stream that can only output to a stream...
DefaultDOTGraphTraits - This class provides the default implementations of all of the DOTGraphTraits ...
Primary interface to the complete machine description for the target machine.
unsigned createJumpTableIndex(const std::vector< MachineBasicBlock *> &DestBBs)
createJumpTableIndex - Create a new jump table.
void dump() const
dump - Call to stderr.
StringRef - Represent a constant reference to a string, i.e.
EK_GPRel32BlockAddress - Each entry is an address of block, encoded with a relocation as gp-relative...
Simple wrapper around std::function<void(raw_ostream&)>.
unsigned getLiveInVirtReg(unsigned PReg) const
getLiveInVirtReg - If PReg is a live-in physical register, return the corresponding live-in physical ...
OutputIt copy(R &&Range, OutputIt Out)
VariableDbgInfoMapTy VariableDbgInfos
static SectionKind getReadOnly()
MachineInstr::mmo_iterator allocateMemRefsArray(unsigned long Num)
allocateMemRefsArray - Allocate an array to hold MachineMemOperand pointers.
unsigned getConstantPoolIndex(const Constant *C, unsigned Alignment)
getConstantPoolIndex - Create a new entry in the constant pool or return an existing one...
unsigned createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
bool needsRelocation() const
This method classifies the entry according to whether or not it may generate a relocation entry...
This class contains meta information specific to a module.
This file describes how to lower LLVM code to machine code.
void addFilterTypeInfo(MachineBasicBlock *LandingPad, ArrayRef< const GlobalValue *> TyInfo)
Provide the filter typeinfo for a landing pad.
const BasicBlock * getParent() const
void tidyLandingPads(DenseMap< MCSymbol *, uintptr_t > *LPMap=nullptr)
Remap landing pad labels and remove any deleted landing pads.