18 #ifndef LLVM_CODEGEN_MACHINEFUNCTION_H
19 #define LLVM_CODEGEN_MACHINEFUNCTION_H
34 class MachineRegisterInfo;
35 class MachineFrameInfo;
36 class MachineConstantPool;
37 class MachineJumpTableInfo;
38 class MachineModuleInfo;
42 class TargetSubtargetInfo;
43 class TargetRegisterClass;
44 struct MachinePointerInfo;
82 return new (Allocator.
Allocate<Ty>()) Ty(MF);
112 std::vector<MachineBasicBlock*> MBBNumbering;
133 unsigned FunctionNumber;
143 bool ExposesReturnsTwice;
186 return *
static_cast<const STC *
>(STI);
229 if (Alignment < A) Alignment =
A;
236 return ExposesReturnsTwice;
242 ExposesReturnsTwice = B;
258 template<
typename Ty>
261 MFInfo = Ty::template create<Ty>(Allocator, *
this);
262 return static_cast<Ty*
>(MFInfo);
265 template<
typename Ty>
276 assert(N < MBBNumbering.size() &&
"Illegal block number");
277 assert(MBBNumbering[N] &&
"Block was removed from the machine function!");
278 return MBBNumbering[
N];
321 void verify(
Pass *p =
nullptr,
const char *Banner =
nullptr)
const;
346 unsigned size()
const {
return (
unsigned)BasicBlocks.
size();}
356 BasicBlocks.
insert(MBBI, MBB);
359 BasicBlocks.
splice(InsertPt, BasicBlocks, MBBI);
362 BasicBlocks.
splice(InsertPt, BasicBlocks, MBBI, MBBE);
369 BasicBlocks.
erase(MBBI);
380 MBBNumbering.push_back(MBB);
381 return (
unsigned)MBBNumbering.size()-1;
388 assert(N < MBBNumbering.size() &&
"Illegal basic block #");
389 MBBNumbering[
N] =
nullptr;
424 unsigned f, uint64_t s,
425 unsigned base_alignment,
434 int64_t Offset, uint64_t Size);
441 return OperandRecycler.
allocate(Cap, Allocator);
453 unsigned Size = (NumRegister + 31) / 32;
454 uint32_t *Mask = Allocator.
Allocate<uint32_t>(Size);
455 for (
unsigned i = 0; i != Size; ++i)
486 bool isLinkerPrivate =
false)
const;
void push_front(MachineBasicBlock *MBB)
Pass interface - Implemented by all 'passes'.
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...
unsigned getAlignment() const
getAlignment - Return the alignment (log2, not bytes) of the function.
static NodeType * getEntryNode(Inverse< MachineFunction * > G)
MachineInstr * CreateMachineInstr(const MCInstrDesc &MCID, DebugLoc DL, bool NoImp=false)
CreateMachineInstr - Allocate a new MachineInstr.
void removeNodeFromList(NodeTy *)
iplist< MachineBasicBlock >::iterator iterator
void RenumberBlocks(MachineBasicBlock *MBBFrom=nullptr)
RenumberBlocks - This discards all of the MachineBasicBlock numbers and recomputes them...
static NodeTy * createNode(const NodeTy &V)
T * allocate(Capacity Cap, AllocatorType &Allocator)
Allocate an array of at least the requested capacity.
static void noteHead(MachineBasicBlock *, MachineBasicBlock *)
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
std::reverse_iterator< iterator > reverse_iterator
static nodes_iterator nodes_end(MachineFunction *F)
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.
static NodeType * getEntryNode(Inverse< const MachineFunction * > G)
bool hasInlineAsm() const
Returns true if the function contains any inline assembly.
ArrayRecycler< MachineOperand >::Capacity OperandCapacity
void verify(Pass *p=nullptr, const char *Banner=nullptr) const
verify - Run the current MachineFunction through the machine code verifier, useful for debugger use...
const Function * getFunction() const
getFunction - Return the LLVM function that this machine code represents
unsigned getFunctionNumber() const
getFunctionNumber - Return a unique ID for the current function.
static nodes_iterator nodes_begin(const MachineFunction *F)
void DeleteMachineBasicBlock(MachineBasicBlock *MBB)
DeleteMachineBasicBlock - Delete the given MachineBasicBlock.
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, unsigned f, uint64_t s, unsigned base_alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr)
getMachineMemOperand - Allocate a new MachineMemOperand.
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
void destroySentinel(MachineBasicBlock *) const
MachineJumpTableInfo * getOrCreateJumpTableInfo(unsigned JTEntryKind)
getOrCreateJumpTableInfo - Get the JumpTableInfo for this function, if it does already exist...
reverse_iterator rbegin()
void viewCFG() const
viewCFG - This function is meant for use from the debugger.
static nodes_iterator nodes_begin(MachineFunction *F)
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
MachineMemOperand - A description of a memory reference used in the backend.
unsigned getNumBlockIDs() const
getNumBlockIDs - Return the number of MBB ID's allocated.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineJumpTableInfo * getJumpTableInfo()
const_reverse_iterator rend() const
void push_front(const NodeTy &val)
const STC & getSubtarget() const
getSubtarget - This method returns a pointer to the specified type of TargetSubtargetInfo.
MachineMemOperand ** mmo_iterator
ilist_default_traits - Default template traits for intrusive list.
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 ...
MachineBasicBlock * provideInitialHead() const
Context object for machine code objects.
const MachineBasicBlock & front() const
MachineBasicBlock * ensureHead(MachineBasicBlock *) const
const MachineJumpTableInfo * getJumpTableInfo() const
getJumpTableInfo - Return the jump table info object for the current function.
MachineFunction::const_iterator nodes_iterator
void print(raw_ostream &OS, SlotIndexes *=nullptr) const
print - Print out the MachineFunction in a format suitable for debugging to the specified stream...
MCContext & getContext() const
const DataLayout & getDataLayout() const
Return the DataLayout attached to the Module associated to this MF.
MachineBasicBlock * CreateMachineBasicBlock(const BasicBlock *bb=nullptr)
CreateMachineBasicBlock - Allocate a new MachineBasicBlock.
const MachineRegisterInfo & getRegInfo() const
static void deleteNode(NodeTy *V)
MachineBasicBlock * createSentinel() const
const MachineFrameInfo * getFrameInfo() const
LLVM Basic Block Representation.
Allocate memory in an ever growing pool, as if by bump-pointer.
size_type LLVM_ATTRIBUTE_UNUSED_RESULT size() const
LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ATTRIBUTE_RETURNS_NOALIAS void * Allocate(size_t Size, size_t Alignment)
Allocate space at the specified alignment.
bool shouldSplitStack()
Should we be emitting segmented stack stuff for the function.
void ensureAlignment(unsigned A)
ensureAlignment - Make sure the function is at least 1 << A bytes aligned.
void viewCFGOnly() const
viewCFGOnly - This function is meant for use from the debugger.
iterator insert(iterator where, const NodeTy &val)
virtual ~MachineFunctionInfo()
void setSubtarget(const TargetSubtargetInfo *ST)
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
void setHasInlineAsm(bool B)
Set a flag that indicates that the function contains inline assembly.
void splice(iterator InsertPt, iterator MBBI, iterator MBBE)
MachineConstantPool * getConstantPool()
getConstantPool - Return the constant pool object for the current function.
static NodeType * getEntryNode(const MachineFunction *F)
void DeleteMachineInstr(MachineInstr *MI)
DeleteMachineInstr - Delete the given MachineInstr.
uint32_t * allocateRegisterMask(unsigned NumRegister)
Allocate and initialize a register mask with NumRegister bits.
MachineFunction::iterator nodes_iterator
MachineBasicBlock & back()
MachinePointerInfo - This class contains a discriminated union of information about pointers in memor...
iterator erase(iterator where)
MCSymbol * getPICBaseSymbol() const
getPICBaseSymbol - Return a function-local symbol to represent the PIC base.
Recycler - This class manages a linked-list of deallocated nodes and facilitates reusing deallocated ...
BasicBlockListType::const_iterator const_iterator
void splice(iterator InsertPt, iterator MBBI)
MachineInstr * CloneMachineInstr(const MachineInstr *Orig)
CloneMachineInstr - Create a new MachineInstr which is a copy of the 'Orig' instruction, identical in all ways except the instruction has no parent, prev, or next.
MachineOperand class - Representation of each machine instruction operand.
MachineBasicBlock * getBlockNumbered(unsigned N) const
getBlockNumbered - MachineBasicBlocks are automatically numbered when they are inserted into the mach...
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
const_iterator end() const
MachineFrameInfo * getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
const MachineConstantPool * getConstantPool() const
void splice(iterator where, iplist &L2)
ilist_half_node< MachineBasicBlock > Sentinel
MCSymbol * getJTISymbol(unsigned JTI, MCContext &Ctx, bool isLinkerPrivate=false) const
getJTISymbol - Return the MCSymbol for the specified non-empty jump table.
Target - Wrapper for Target specific information.
void dump() const
dump - Print the current MachineFunction to cerr, useful for debugger use.
static unsigned size(MachineFunction *F)
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
TargetSubtargetInfo - Generic base class for all target subtargets.
std::reverse_iterator< const_iterator > const_reverse_iterator
Representation of each machine instruction.
static NodeType * getEntryNode(MachineFunction *F)
static Ty * create(BumpPtrAllocator &Allocator, MachineFunction &MF)
Factory function: default behavior is to call new using the supplied allocator.
static unsigned size(const MachineFunction *F)
void addNodeToList(NodeTy *)
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
bool exposesReturnsTwice() const
exposesReturnsTwice - Returns true if the function calls setjmp or any other similar functions with a...
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
MachineBasicBlock & front()
void setExposesReturnsTwice(bool B)
setCallsSetJmp - Set a flag that indicates if there's a call to a "returns twice" function...
void removeFromMBBNumbering(unsigned N)
removeFromMBBNumbering - Remove the specific machine basic block from our tracker, this is only really to be used by the MachineBasicBlock implementation.
static NodeTy * createSentinel()
createSentinel - create the dynamic sentinel
const Ty * getInfo() const
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...
void erase(iterator MBBI)
void insert(iterator MBBI, MachineBasicBlock *MBB)
static nodes_iterator nodes_end(const MachineFunction *F)
unsigned addToMBBNumbering(MachineBasicBlock *MBB)
Adds the MBB to the internal numbering.
void deallocateOperandArray(OperandCapacity Cap, MachineOperand *Array)
Dellocate an array of MachineOperands and recycle the memory.
void push_back(MachineBasicBlock *MBB)
void setAlignment(unsigned A)
setAlignment - Set the alignment (log2, not bytes) of the function.
BasicBlockListType::iterator iterator
This class implements an extremely fast bulk output stream that can only output to a stream...
Primary interface to the complete machine description for the target machine.
const MachineBasicBlock & back() const
const_reverse_iterator rbegin() const
void deallocate(Capacity Cap, T *Ptr)
Deallocate an array with the specified Capacity.
StringRef - Represent a constant reference to a string, i.e.
MachineModuleInfo & getMMI() const
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
const_iterator begin() const
reverse_iterator rbegin()
NodeTy * remove(iterator &IT)
MachineInstr::mmo_iterator allocateMemRefsArray(unsigned long Num)
allocateMemRefsArray - Allocate an array to hold MachineMemOperand pointers.
MachineOperand * allocateOperandArray(OperandCapacity Cap)
Allocate an array of MachineOperands.
void push_back(const NodeTy &val)
MachineModuleInfo - This class contains meta information specific to a module.