1//===- llvm/CodeGen/MachineFunction.h ---------------------------*- C++ -*-===//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//===----------------------------------------------------------------------===//
9// Collect native machine code for a function. This class contains a list of
10// MachineBasicBlock instances that make up the current compiled function.
12// This class also contains pointers to various classes which hold
13// target-specific information about the generated code.
15//===----------------------------------------------------------------------===//
17#ifndef LLVM_CODEGEN_MACHINEFUNCTION_H
18#define LLVM_CODEGEN_MACHINEFUNCTION_H
85 template <
class Iterator>
87 assert(
this == &OldList &&
"never transfer MBBs between functions");
91// The hotness of static data tracked by a MachineFunction and not represented
92// as a global object in the module IR / MIR. Typical examples are
93// MachineJumpTableInfo and MachineConstantPool.
100/// MachineFunctionInfo - This class can be derived from and used by targets to
101/// hold private target-specific information for each MachineFunction. Objects
102/// of type are accessed/created with MF::getInfo and destroyed when the
103/// MachineFunction is destroyed.
107 /// Factory function: default behavior is to call new using the
108 /// supplied allocator.
110 /// This function can be overridden in a derive class.
111 template <
typename FuncInfoTy,
typename SubtargetTy = TargetSubtargetInfo>
113 const SubtargetTy *STI) {
114 return new (
Allocator.Allocate<FuncInfoTy>()) FuncInfoTy(
F, STI);
117 template <
typename Ty>
119 return new (
Allocator.Allocate<Ty>()) Ty(MFI);
122 /// Make a functionally equivalent copy of this MachineFunctionInfo in \p MF.
123 /// This requires remapping MachineBasicBlock references from the original
124 /// parent to values in the new function. Targets may assume that virtual
125 /// register and frame index values are preserved in the new function.
134/// Properties which a MachineFunction may have at a given point in time.
135/// Each of these has checking code in the MachineVerifier, and passes can
136/// require that a property be set.
138 // Possible TODO: Allow targets to extend this (perhaps by allowing the
139 // constructor to specify the size of the bit vector)
140 // Possible TODO: Allow requiring the negative (e.g. VRegsAllocated could be
141 // stated as the negative of "has vregs"
144 // The properties are stated in "positive" form; i.e. a pass could require
145 // that the property hold, but not that it does not hold.
147 // Property descriptions:
148 // IsSSA: True when the machine function is in SSA form and virtual registers
149 // have a single def.
150 // NoPHIs: The machine function does not contain any PHI instruction.
151 // TracksLiveness: True when tracking register liveness accurately.
152 // While this property is set, register liveness information in basic block
153 // live-in lists and machine instruction operands (e.g. implicit defs) is
154 // accurate, kill flags are conservatively accurate (kill flag correctly
155 // indicates the last use of a register, an operand without kill flag may or
156 // may not be the last use of a register). This means it can be used to
157 // change the code in ways that affect the values in registers, for example
158 // by the register scavenger.
159 // When this property is cleared at a very late time, liveness is no longer
161 // NoVRegs: The machine function does not use any virtual registers.
162 // Legalized: In GlobalISel: the MachineLegalizer ran and all pre-isel generic
163 // instructions have been legalized; i.e., all instructions are now one of:
164 // - generic and always legal (e.g., COPY)
166 // - legal pre-isel generic instructions.
167 // RegBankSelected: In GlobalISel: the RegBankSelect pass ran and all generic
168 // virtual registers have been assigned to a register bank.
169 // Selected: In GlobalISel: the InstructionSelect pass ran and all pre-isel
170 // generic instructions have been eliminated; i.e., all instructions are now
171 // target-specific or non-pre-isel generic instructions (e.g., COPY).
172 // Since only pre-isel generic instructions can have generic virtual register
173 // operands, this also means that all generic virtual registers have been
174 // constrained to virtual registers (assigned to register classes) and that
175 // all sizes attached to them have been eliminated.
176 // TiedOpsRewritten: The twoaddressinstruction pass will set this flag, it
177 // means that tied-def have been rewritten to meet the RegConstraint.
178 // FailsVerification: Means that the function is not expected to pass machine
179 // verification. This can be set by passes that introduce known problems that
180 // have not been fixed yet.
181 // TracksDebugUserValues: Without this property enabled, debug instructions
182 // such as DBG_VALUE are allowed to reference virtual registers even if those
183 // registers do not have a definition. With the property enabled virtual
184 // registers must only be used if they have a definition. This property
185 // allows earlier passes in the pipeline to skip updates of `DBG_VALUE`
186 // instructions to save compile time.
204 return Properties[
static_cast<unsigned>(
P)];
208 Properties.
set(
static_cast<unsigned>(
P));
213 Properties.
reset(
static_cast<unsigned>(
P));
217 // Per property has/set/reset accessors.
218 #define PPACCESSORS(X) \
219 bool has##X() const { return hasProperty(Property::X); } \
220 MachineFunctionProperties &set##X(void) { return set(Property::X); } \
221 MachineFunctionProperties &reset##X(void) { return reset(Property::X); }
236 /// Reset all the properties.
243 Properties |= MFP.Properties;
248 Properties &= ~MFP.Properties;
252 // Returns true if all properties set in V (i.e. required by a pass) are set
255 return (Properties | ~V.Properties).all();
258 /// Print the MachineFunctionProperties in human-readable form.
266 /// Filter or finally function. Null indicates a catch-all.
269 /// Address of block to recover at. Null for a finally handler.
273/// This structure is used to retain landing pad info for the current function.
280 std::vector<int>
TypeIds;
// List of type ids (filters negative).
292 // RegInfo - Information about each register in use in the function.
295 // Used to keep track of target-specific per-machine-function information for
296 // the target implementation.
299 // Keep track of objects allocated on the stack.
302 // Keep track of constants which are spilled to memory
305 // Keep track of jump tables for switch instructions
308 // Keep track of the function section.
311 // Catchpad unwind destination info for wasm EH.
312 // Keeps track of Wasm exception handling related data. This will be null for
313 // functions that aren't using a wasm EH personality.
316 // Keeps track of Windows exception handling related data. This will be null
317 // for functions that aren't using a funclet-based EH personality.
320 // Function-level unique numbering for MachineBasicBlocks. When a
321 // MachineBasicBlock is inserted into a MachineFunction is it automatically
322 // numbered and this vector keeps track of the mapping from ID's to MBB's.
323 std::vector<MachineBasicBlock*> MBBNumbering;
325 // MBBNumbering epoch, incremented after renumbering to detect use of old
327 unsigned MBBNumberingEpoch = 0;
329 // Pool-allocate MachineFunction-lifetime and IR objects.
332 // Allocation management for instructions in function.
335 // Allocation management for operand arrays on instructions.
338 // Allocation management for basic blocks in function.
341 // List of machine basic blocks in function
343 BasicBlockListType BasicBlocks;
345 /// FunctionNumber - This provides a unique ID for each function emitted in
346 /// this translation unit.
348 unsigned FunctionNumber;
350 /// Alignment - The alignment of the function.
353 /// ExposesReturnsTwice - True if the function calls setjmp or related
354 /// functions with attribute "returns twice", but doesn't have
355 /// the attribute itself.
356 /// This is used to limit optimizations which cannot reason
357 /// about the control flow of such functions.
358 bool ExposesReturnsTwice =
false;
360 /// True if the function includes any inline assembly.
361 bool HasInlineAsm =
false;
363 /// True if any WinCFI instruction have been emitted in this function.
364 bool HasWinCFI =
false;
366 /// Current high-level properties of the IR of the function (e.g. is in SSA
367 /// form or whether registers have been allocated)
370 // Allocation management for pseudo source values.
371 std::unique_ptr<PseudoSourceValueManager> PSVManager;
373 /// List of moves done by a function's prolog. Used to construct frame maps
374 /// by debug and exception handling consumers.
375 std::vector<MCCFIInstruction> FrameInstructions;
377 /// List of basic blocks immediately following calls to _setjmp. Used to
378 /// construct a table of valid longjmp targets for Windows Control Flow Guard.
379 std::vector<MCSymbol *> LongjmpTargets;
381 /// List of basic blocks that are the targets for Windows EH Continuation
383 std::vector<MCSymbol *> EHContTargets;
385 /// \name Exception Handling
388 /// List of LandingPadInfo describing the landing pad information.
389 std::vector<LandingPadInfo> LandingPads;
391 /// Map a landing pad's EH symbol to the call site indexes.
394 /// Map a landing pad to its index.
397 /// Map of invoke call site index values to associated begin EH_LABEL.
400 /// CodeView label annotations.
401 std::vector<std::pair<MCSymbol *, MDNode *>> CodeViewAnnotations;
403 bool CallsEHReturn =
false;
404 bool CallsUnwindInit =
false;
405 bool HasEHContTarget =
false;
406 bool HasEHScopes =
false;
407 bool HasEHFunclets =
false;
408 bool HasFakeUses =
false;
409 bool IsOutlined =
false;
411 /// BBID to assign to the next basic block of this function.
412 unsigned NextBBID = 0;
414 /// Section Type for basic blocks, only relevant with basic block sections.
417 /// List of C++ TypeInfo used.
418 std::vector<const GlobalValue *> TypeInfos;
420 /// List of typeids encoding filters used.
421 std::vector<unsigned> FilterIds;
423 /// List of the indices in FilterIds corresponding to filter terminators.
424 std::vector<unsigned> FilterEnds;
430 /// Clear all the members of this MachineFunction, but the ones used to
431 /// initialize again the MachineFunction. More specifically, this deallocates
432 /// all the dynamically allocated objects and get rids of all the XXXInfo data
433 /// structure, but keeps unchanged the references to Fn, Target, and
436 /// Allocate and initialize the different members.
437 /// In particular, the XXXInfo data structure.
438 /// \pre Fn, Target, and FunctionNumber are properly set.
442 /// Description of the location of a variable whose Address is valid and
443 /// unchanging during function execution. The Address may be:
444 /// * A stack index, which can be negative for fixed stack objects.
445 /// * A MCRegister, whose entry value contains the address of the variable.
447 std::variant<int, MCRegister> Address;
462 /// Return true if this variable is in a stack slot.
463 bool inStackSlot()
const {
return std::holds_alternative<int>(Address); }
465 /// Return true if this variable is in the entry value of a register.
467 return std::holds_alternative<MCRegister>(Address);
470 /// Returns the stack slot of this variable, assuming `inStackSlot()` is
474 /// Returns the MCRegister of this variable, assuming
475 /// `inEntryValueRegister()` is true.
477 return std::get<MCRegister>(Address);
480 /// Updates the stack slot of this variable, assuming `inStackSlot()` is
489 virtual void anchor();
493 /// Callback after an insertion. This should not modify the MI directly.
495 /// Callback before a removal. This should not modify the MI directly.
497 /// Callback before changing MCInstrDesc. This should not modify the MI
503 /// Structure used to represent pair of argument number after call lowering
504 /// and register used to transfer that argument.
505 /// For now we support only cases when argument is transferred through one
511 assert(Arg < (1 << 16) &&
"Arg out of range");
516 /// Vector of call argument and its forwarding register.
523 /// Extracts the numeric type id from the CallBase's callee_type Metadata,
524 /// and sets CalleeTypeIds. This is used as type id for the indirect call in
525 /// the call graph section.
540 /// Map a call instruction to call site arguments forwarding info.
543 /// A helper function that returns call site info for a give call
544 /// instruction if debug entry value support is enabled.
548 /// Mapping of call instruction to the global value and target flags that it
549 /// calls, if applicable.
550 CalledGlobalsMap CalledGlobalsInfo;
552 // Callbacks for insertion and removal.
558 // Need to be accessed from MachineInstr::setDesc.
564 /// A count of how many instructions in the function have had numbers
565 /// assigned to them. Used for debug value tracking, to determine the
566 /// next instruction number.
569 /// Set value of DebugInstrNumberingCount field. Avoid using this unless
570 /// you're deserializing this data.
573 /// Pair of instruction number and operand number.
576 /// Replacement definition for a debug instruction reference. Made up of a
577 /// source instruction / operand pair, destination pair, and a qualifying
578 /// subregister indicating what bits in the operand make up the substitution.
579 // For example, a debug user
581 /// %0:gr32 = someinst, debug-instr-number 1
582 /// %1:gr16 = %0.some_16_bit_subreg, debug-instr-number 2
583 /// Would receive the substitution {{2, 0}, {1, 0}, $subreg}, where $subreg is
584 /// the subregister number for some_16_bit_subreg.
589 unsigned Subreg;
///< Qualifier for which part of Dest is read.
595 /// Order only by source instruction / operand pair: there should never
596 /// be duplicate entries for the same source in any collection.
602 /// Debug value substitutions: a collection of DebugSubstitution objects,
603 /// recording changes in where a value is defined. For example, when one
604 /// instruction is substituted for another. Keeping a record allows recovery
605 /// of variable locations after compilation finishes.
608 /// Location of a PHI instruction that is also a debug-info variable value,
609 /// for the duration of register allocation. Loaded by the PHI-elimination
610 /// pass, and emitted as DBG_PHI instructions during VirtRegRewriter, with
611 /// maintenance applied by intermediate passes that edit registers (such as
612 /// coalescing and the allocator passes).
617 unsigned SubReg;
///< Optional subreg qualifier within Reg.
622 /// Map of debug instruction numbers to the position of their PHI instructions
623 /// during register allocation. See DebugPHIRegallocPos.
626 /// Flag for whether this function contains DBG_VALUEs (false) or
627 /// DBG_INSTR_REF (true).
630 /// Create a substitution between one <instr,operand> value to a different,
635 /// Create substitutions for any tracked values in \p Old, to point at
636 /// \p New. Needed when we re-create an instruction during optimization,
637 /// which has the same signature (i.e., def operands in the same place) but
638 /// a modified instruction type, flags, or otherwise. An example: X86 moves
639 /// are sometimes transformed into equivalent LEAs.
640 /// If the two instructions are not the same opcode, limit which operands to
641 /// examine for substitutions to the first N operands by setting
644 unsigned MaxOperand = UINT_MAX);
646 /// Find the underlying defining instruction / operand for a COPY instruction
647 /// while in SSA form. Copies do not actually define values -- they move them
648 /// between registers. Labelling a COPY-like instruction with an instruction
649 /// number is to be avoided as it makes value numbers non-unique later in
650 /// compilation. This method follows the definition chain for any sequence of
651 /// COPY-like instructions to find whatever non-COPY-like instruction defines
652 /// the copied value; or for parameters, creates a DBG_PHI on entry.
653 /// May insert instructions into the entry block!
654 /// \p MI The copy-like instruction to salvage.
655 /// \p DbgPHICache A container to cache already-solved COPYs.
656 /// \returns An instruction/operand pair identifying the defining value.
663 /// Finalise any partially emitted debug instructions. These are DBG_INSTR_REF
664 /// instructions where we only knew the vreg of the value they use, not the
665 /// instruction that defines that vreg. Once isel finishes, we should have
666 /// enough information for every DBG_INSTR_REF to point at an instruction
670 /// Determine whether, in the current machine configuration, we should use
671 /// instruction referencing or not.
674 /// Returns true if the function's variable locations are tracked with
675 /// instruction referencing.
678 /// Set whether this function will use instruction referencing or not.
681 /// A reserved operand number representing the instructions memory operand,
682 /// for instructions that have a stack spill fused into them.
687 unsigned FunctionNum);
692 /// Reset the instance as if it was just created.
698 /// Reset the currently registered delegate - otherwise assert.
700 assert(TheDelegate == delegate &&
701 "Only the current delegate can perform reset!");
702 TheDelegate =
nullptr;
705 /// Set the delegate. resetDelegate must be called before attempting
708 assert(delegate && !TheDelegate &&
709 "Attempted to set delegate to null, or to change it without "
710 "first resetting it!");
712 TheDelegate = delegate;
721 /// Returns the Section this function belongs to.
724 /// Indicates the Section this function belongs to.
729 /// Return the DataLayout attached to the Module associated to this MF.
732 /// Return the LLVM function that this machine code represents
735 /// Return the LLVM function that this machine code represents
738 /// getName - Return the name of the corresponding LLVM function.
741 /// getFunctionNumber - Return a unique ID for the current function.
744 /// Returns true if this function has basic block sections enabled.
753 /// Assign IsBeginSection IsEndSection fields for basic blocks in this
755 void assignBeginEndSections();
757 /// getTarget - Return the target machine this machine code is compiled with
760 /// getSubtarget - Return the subtarget for which this machine code is being
764 /// getSubtarget - This method returns a pointer to the specified type of
765 /// TargetSubtargetInfo. In debug builds, it verifies that the object being
766 /// returned is of the correct type.
768 return static_cast<const STC &
>(STI);
771 /// getRegInfo - Return information about the registers currently in use.
775 /// getFrameInfo - Return the frame info object for the current function.
776 /// This object contains information about objects allocated on the stack
777 /// frame of the current function in an abstract way.
781 /// getJumpTableInfo - Return the jump table info object for the current
782 /// function. This object contains information about jump tables in the
783 /// current function. If the current function has no jump tables, this will
788 /// getOrCreateJumpTableInfo - Get the JumpTableInfo for this function, if it
789 /// does already exist, allocate one.
792 /// getConstantPool - Return the constant pool object for the current
797 /// getWasmEHFuncInfo - Return information about how the current function uses
798 /// Wasm exception handling. Returns null for functions that don't use wasm
799 /// exception handling.
803 /// getWinEHFuncInfo - Return information about how the current function uses
804 /// Windows exception handling. Returns null for functions that don't use
805 /// funclets for exception handling.
809 /// getAlignment - Return the alignment of the function.
812 /// setAlignment - Set the alignment of the function.
815 /// ensureAlignment - Make sure the function is at least A bytes aligned.
821 /// exposesReturnsTwice - Returns true if the function calls setjmp or
822 /// any other similar functions with attribute "returns twice" without
823 /// having the attribute itself.
825 return ExposesReturnsTwice;
828 /// setCallsSetJmp - Set a flag that indicates if there's a call to
829 /// a "returns twice" function.
831 ExposesReturnsTwice =
B;
834 /// Returns true if the function contains any inline assembly.
839 /// Set a flag that indicates that the function contains inline assembly.
849 /// True if this function needs frame moves for debug or exceptions.
850 bool needsFrameMoves()
const;
852 /// Get the function properties
856 /// getInfo - Keep track of various per-function pieces of information for
857 /// backends that would like to do so.
859 template<
typename Ty>
861 return static_cast<Ty*
>(MFInfo);
864 template<
typename Ty>
866 return static_cast<const Ty *
>(MFInfo);
871 MFInfo = Ty::template create<Ty>(Allocator, Old);
872 return static_cast<Ty *
>(MFInfo);
875 /// Initialize the target specific MachineFunctionInfo
881 assert(!MFInfo &&
"new function already has MachineFunctionInfo");
884 return OrigMF.MFInfo->
clone(Allocator, *
this, Src2DstMBB);
887 /// Returns the denormal handling type for the default rounding mode of the
891 /// getBlockNumbered - MachineBasicBlocks are automatically numbered when they
892 /// are inserted into the machine function. The block number for a machine
893 /// basic block can be found by using the MBB::getNumber method, this method
894 /// provides the inverse mapping.
896 assert(
N < MBBNumbering.size() &&
"Illegal block number");
897 assert(MBBNumbering[
N] &&
"Block was removed from the machine function!");
898 return MBBNumbering[
N];
901 /// Should we be emitting segmented stack stuff for the function
902 bool shouldSplitStack()
const;
904 /// getNumBlockIDs - Return the number of MBB ID's allocated.
907 /// Return the numbering "epoch" of block numbers, incremented after each
908 /// numbering. Intended for asserting that no renumbering was performed when
909 /// used by, e.g., preserved analyses.
912 /// RenumberBlocks - This discards all of the MachineBasicBlock numbers and
913 /// recomputes them. This guarantees that the MBB numbers are sequential,
914 /// dense, and match the ordering of the blocks within the function. If a
915 /// specific MachineBasicBlock is specified, only that block and those after
916 /// it are renumbered.
919 /// Return an estimate of the function's code size,
920 /// taking into account block and function alignment
923 /// print - Print out the MachineFunction in a format suitable for debugging
924 /// to the specified stream.
927 /// viewCFG - This function is meant for use from the debugger. You can just
928 /// say 'call F->viewCFG()' and a ghostview window should pop up from the
929 /// program, displaying the CFG of the current function with the code for each
930 /// basic block inside. This depends on there being a 'dot' and 'gv' program
934 /// viewCFGOnly - This function is meant for use from the debugger. It works
935 /// just like viewCFG, but it does not include the contents of basic blocks
936 /// into the nodes, just the label. If you are only interested in the CFG
937 /// this can make the graph smaller.
939 void viewCFGOnly()
const;
941 /// dump - Print the current MachineFunction to cerr, useful for debugger use.
944 /// Run the current MachineFunction through the machine code verifier, useful
945 /// for debugger use.
946 /// \returns true if no problems were found.
947 bool verify(
Pass *p =
nullptr,
const char *Banner =
nullptr,
948 raw_ostream *OS =
nullptr,
bool AbortOnError =
true)
const;
950 /// For New Pass Manager: Run the current MachineFunction through the machine
951 /// code verifier, useful for debugger use.
952 /// \returns true if no problems were found.
954 const char *Banner =
nullptr,
raw_ostream *OS =
nullptr,
955 bool AbortOnError =
true)
const;
957 /// Run the current MachineFunction through the machine code verifier, useful
958 /// for debugger use.
959 /// TODO: Add the param for LiveStacks analysis.
960 /// \returns true if no problems were found.
962 const char *Banner =
nullptr,
raw_ostream *OS =
nullptr,
963 bool AbortOnError =
true)
const;
965 // Provide accessors for the MachineBasicBlock list...
971 /// Support for MachineBasicBlock::getNextNode().
974 return &MachineFunction::BasicBlocks;
977 /// addLiveIn - Add the specified physical register as a live-in value and
978 /// create a corresponding virtual register for it.
981 //===--------------------------------------------------------------------===//
982 // BasicBlock accessor functions.
994 unsigned size()
const {
return (
unsigned)BasicBlocks.size();}
995 bool empty()
const {
return BasicBlocks.empty(); }
1004 BasicBlocks.insert(
MBBI,
MBB);
1007 BasicBlocks.splice(InsertPt, BasicBlocks,
MBBI);
1010 BasicBlocks.splice(InsertPt, BasicBlocks,
MBB);
1013 BasicBlocks.splice(InsertPt, BasicBlocks,
MBBI, MBBE);
1021 template <
typename Comp>
1023 BasicBlocks.sort(comp);
1026 /// Return the number of \p MachineInstrs in this \p MachineFunction.
1034 //===--------------------------------------------------------------------===//
1035 // Internal functions used to automatically number MachineBasicBlocks
1037 /// Adds the MBB to the internal numbering. Returns the unique number
1038 /// assigned to the MBB.
1040 MBBNumbering.push_back(
MBB);
1041 return (
unsigned)MBBNumbering.size()-1;
1044 /// removeFromMBBNumbering - Remove the specific machine basic block from our
1045 /// tracker, this is only really to be used by the MachineBasicBlock
1048 assert(
N < MBBNumbering.size() &&
"Illegal basic block #");
1049 MBBNumbering[
N] =
nullptr;
1052 /// CreateMachineInstr - Allocate a new MachineInstr. Use this instead
1053 /// of `new MachineInstr'.
1055 bool NoImplicit =
false);
1057 /// Create a new MachineInstr which is a copy of \p Orig, identical in all
1058 /// ways except the instruction has no parent, prev, or next. Bundling flags
1061 /// Note: Clones a single instruction, not whole instruction bundles.
1062 /// Does not perform target specific adjustments; consider using
1063 /// TargetInstrInfo::duplicate() instead.
1066 /// Clones instruction or the whole instruction bundle \p Orig and insert
1067 /// into \p MBB before \p InsertBefore.
1069 /// Note: Does not perform target specific adjustments; consider using
1070 /// TargetInstrInfo::duplicate() instead.
1076 /// DeleteMachineInstr - Delete the given MachineInstr.
1079 /// CreateMachineBasicBlock - Allocate a new MachineBasicBlock. Use this
1080 /// instead of `new MachineBasicBlock'. Sets `MachineBasicBlock::BBID` if
1081 /// basic-block-sections is enabled for the function.
1083 CreateMachineBasicBlock(
const BasicBlock *BB =
nullptr,
1084 std::optional<UniqueBBID> BBID = std::nullopt);
1086 /// DeleteMachineBasicBlock - Delete the given MachineBasicBlock.
1089 /// getMachineMemOperand - Allocate a new MachineMemOperand.
1090 /// MachineMemOperands are owned by the MachineFunction and need not be
1091 /// explicitly deallocated.
1111 BaseAlignment, AAInfo, Ranges, SSID, Ordering,
1121 BaseAlignment, AAInfo, Ranges, SSID, Ordering,
1125 /// getMachineMemOperand - Allocate a new MachineMemOperand by copying
1126 /// an existing one, adjusting by an offset and using the given size.
1127 /// MachineMemOperands are owned by the MachineFunction and need not be
1128 /// explicitly deallocated.
1149 /// getMachineMemOperand - Allocate a new MachineMemOperand by copying
1150 /// an existing one, replacing only the MachinePointerInfo and size.
1151 /// MachineMemOperands are owned by the MachineFunction and need not be
1152 /// explicitly deallocated.
1170 /// Allocate a new MachineMemOperand by copying an existing one,
1171 /// replacing only AliasAnalysis information. MachineMemOperands are owned
1172 /// by the MachineFunction and need not be explicitly deallocated.
1176 /// Allocate a new MachineMemOperand by copying an existing one,
1177 /// replacing the flags. MachineMemOperands are owned
1178 /// by the MachineFunction and need not be explicitly deallocated.
1184 /// Allocate an array of MachineOperands. This is only intended for use by
1185 /// internal MachineInstr functions.
1187 return OperandRecycler.allocate(Cap, Allocator);
1190 /// Dellocate an array of MachineOperands and recycle the memory. This is
1191 /// only intended for use by internal MachineInstr functions.
1192 /// Cap must be the same capacity that was used to allocate the array.
1194 OperandRecycler.deallocate(Cap, Array);
1197 /// Allocate and initialize a register mask with @p NumRegister bits.
1202 /// Allocate and construct an extra info structure for a `MachineInstr`.
1204 /// This is allocated on the function's allocator and so lives the life of
1206 MachineInstr::ExtraInfo *createMIExtraInfo(
1208 MCSymbol *PostInstrSymbol =
nullptr,
MDNode *HeapAllocMarker =
nullptr,
1210 MDNode *MMRAs =
nullptr);
1212 /// Allocate a string and populate it with the given external symbol name.
1213 const char *createExternalSymbolName(
StringRef Name);
1215 //===--------------------------------------------------------------------===//
1216 // Label Manipulation.
1218 /// getJTISymbol - Return the MCSymbol for the specified non-empty jump table.
1219 /// If isLinkerPrivate is specified, an 'l' label is returned, otherwise a
1220 /// normal 'L' label is returned.
1222 bool isLinkerPrivate =
false)
const;
1224 /// getPICBaseSymbol - Return a function-local symbol to represent the PIC
1226 MCSymbol *getPICBaseSymbol()
const;
1228 /// Returns a reference to a list of cfi instructions in the function's
1229 /// prologue. Used to construct frame maps for debug and exception handling
1232 return FrameInstructions;
1237 /// Returns a reference to a list of symbols immediately following calls to
1238 /// _setjmp in the function. Used to construct the longjmp target table used
1239 /// by Windows Control Flow Guard.
1241 return LongjmpTargets;
1244 /// Add the specified symbol to the list of valid longjmp targets for Windows
1245 /// Control Flow Guard.
1248 /// Returns a reference to a list of symbols that are targets for Windows
1249 /// EH Continuation Guard.
1251 return EHContTargets;
1254 /// Add the specified symbol to the list of targets for Windows EH
1255 /// Continuation Guard.
1258 /// Tries to get the global and target flags for a call site, if the
1259 /// instruction is a call to a global.
1261 return CalledGlobalsInfo.lookup(
MI);
1264 /// Notes the global and target flags for a call site.
1266 assert(
MI &&
"MI must not be null");
1268 CalledGlobalsInfo.insert({
MI, Details});
1271 /// Iterates over the full set of call sites and their associated globals.
1273 return llvm::make_range(CalledGlobalsInfo.begin(), CalledGlobalsInfo.end());
1276 /// \name Exception Handling
1300 /// Find or create an LandingPadInfo for the specified MachineBasicBlock.
1303 /// Return a reference to the landing pad info for the current function.
1308 /// Provide the begin and end labels of an invoke style call and associate it
1309 /// with a try landing pad block.
1313 /// Add a new panding pad, and extract the exception handling information from
1314 /// the landingpad instruction. Returns the label ID for the landing pad
1318 /// Return the type id for the specified typeinfo. This is function wide.
1321 /// Return the id of the filter encoded by TyIds. This is function wide.
1324 /// Map the landing pad's EH symbol to the call site indexes.
1327 /// Return if there is any wasm exception handling.
1329 return !WasmLPadToIndexMap.empty();
1332 /// Map the landing pad to its index. Used for Wasm exception handling.
1334 WasmLPadToIndexMap[LPad] = Index;
1337 /// Returns true if the landing pad has an associate index in wasm EH.
1339 return WasmLPadToIndexMap.count(LPad);
1342 /// Get the index in wasm EH for a given landing pad.
1345 return WasmLPadToIndexMap.lookup(LPad);
1349 return !LPadToCallSiteMap.empty();
1352 /// Get the call site indexes for a landing pad EH symbol.
1355 "missing call site number for landing pad!");
1356 return LPadToCallSiteMap[Sym];
1359 /// Return true if the landing pad Eh symbol has an associated call site.
1361 return !LPadToCallSiteMap[Sym].empty();
1365 return !CallSiteMap.empty();
1368 /// Map the begin label for a call site.
1370 CallSiteMap[BeginLabel] = Site;
1373 /// Get the call site number for a begin label.
1376 "Missing call site number for EH_LABEL!");
1377 return CallSiteMap.lookup(BeginLabel);
1380 /// Return true if the begin label has a call site number associated with it.
1382 return CallSiteMap.count(BeginLabel);
1385 /// Record annotations associated with a particular label.
1387 CodeViewAnnotations.push_back({Label, MD});
1391 return CodeViewAnnotations;
1394 /// Return a reference to the C++ typeinfo for the current function.
1399 /// Return a reference to the typeids encoding filters used in the current
1407 /// Collect information used to emit debugging information of a variable in a
1414 /// Collect information used to emit debugging information of a variable in
1415 /// the entry value of a register.
1426 /// Returns the collection of variables for which we have debug info and that
1427 /// have been assigned a stack slot.
1430 return VarInfo.inStackSlot();
1434 /// Returns the collection of variables for which we have debug info and that
1435 /// have been assigned a stack slot.
1438 return VarInfo.inStackSlot();
1442 /// Returns the collection of variables for which we have debug info and that
1443 /// have been assigned an entry value register.
1446 return VarInfo.inEntryValueRegister();
1450 /// Start tracking the arguments passed to the call \p CallI.
1454 CallSitesInfo.try_emplace(CallI, std::move(
CallInfo)).second;
1456 assert(Inserted &&
"Call site info not unique");
1460 return CallSitesInfo;
1463 /// Following functions update call site info. They should be called before
1464 /// removing, replacing or copying call instruction.
1466 /// Erase the call site info for \p MI. It is used to remove a call
1467 /// instruction from the instruction stream.
1469 /// Copy the call site info from \p Old to \ New. Its usage is when we are
1470 /// making a copy of the instruction that will be inserted at different point
1471 /// of the instruction stream.
1474 /// Move the call site info from \p Old to \New call site info. This function
1475 /// is used when we are replacing one call instruction with another one to
1476 /// the same callee.
1484//===--------------------------------------------------------------------===//
1485// GraphTraits specializations for function basic block graphs (CFGs)
1486//===--------------------------------------------------------------------===//
1488// Provide specializations of GraphTraits to be able to treat a
1489// machine function as a graph of machine basic blocks... these are
1490// the same as the machine basic block iterators, except that the root
1491// node is implicitly the first node of the function.
1497 // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
1511 return F->getNumBlockIDs();
1514 return F->getBlockNumberEpoch();
1521 // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
1537 return F->getNumBlockIDs();
1540 return F->getBlockNumberEpoch();
1544// Provide specializations of GraphTraits to be able to treat a function as a
1545// graph of basic blocks... and to walk it in inverse order. Inverse order for
1546// a function is considered to be when traversing the predecessor edges of a BB
1547// instead of the successor edges.
1552 return &
G.Graph->front();
1556 return F->getNumBlockIDs();
1559 return F->getBlockNumberEpoch();
1565 return &
G.Graph->front();
1569 return F->getNumBlockIDs();
1572 return F->getBlockNumberEpoch();
1577 const MachineFunction &MF);
1579}
// end namespace llvm
1581#endif // LLVM_CODEGEN_MACHINEFUNCTION_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
This file defines the BumpPtrAllocator interface.
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
Atomic ordering constants.
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static void viewCFG(Function &F, const BlockFrequencyInfo *BFI, const BranchProbabilityInfo *BPI, uint64_t MaxFreq, bool CFGOnly=false)
static unsigned InstrCount
This file defines the DenseMap class.
This file defines the little GraphTraits<X> template class that should be specialized by classes that...
static uint64_t estimateFunctionSizeInBytes(const LoongArchInstrInfo *TII, const MachineFunction &MF)
static unsigned addLiveIn(MachineFunction &MF, unsigned PReg, const TargetRegisterClass *RC)
static StringRef getName(Value *V)
This file defines the SmallVector class.
static MachineMemOperand * getMachineMemOperand(MachineFunction &MF, FrameIndexSDNode &FI)
The size of an allocated array is represented by a Capacity instance.
Recycle small arrays allocated from a BumpPtrAllocator.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
LLVM Basic Block Representation.
The address of a basic block.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
A parsed version of the target data layout string in and methods for querying it.
DenseMapIterator< KeyT, ValueT, KeyInfoT, BucketT > iterator
Abstract class that contains various methods for clients to notify about changes.
static constexpr LLT scalable_vector(unsigned MinNumElements, unsigned ScalarSizeInBits)
Get a low-level scalable vector of some number of elements and element width.
static constexpr LLT scalar(unsigned SizeInBits)
Get a low-level scalar or aggregate "bag of bits".
static LocationSize precise(uint64_t Value)
Context object for machine code objects.
Describe properties that are true of each instruction in the target description file.
Wrapper class representing physical registers. Should be passed by value.
Instances of this class represent a uniqued identifier for a section in the current translation unit.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
MachineInstrBundleIterator< MachineInstr > iterator
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
Properties which a MachineFunction may have at a given point in time.
MachineFunctionProperties & set(const MachineFunctionProperties &MFP)
LLVM_ABI void print(raw_ostream &OS) const
Print the MachineFunctionProperties in human-readable form.
bool verifyRequiredProperties(const MachineFunctionProperties &V) const
MachineFunctionProperties & reset(const MachineFunctionProperties &MFP)
MachineFunctionProperties & set(Property P)
bool hasProperty(Property P) const
MachineFunctionProperties & reset(Property P)
DebugPHIRegallocPos(MachineBasicBlock *MBB, Register Reg, unsigned SubReg)
Register Reg
VReg where the control-flow-merge happens.
unsigned SubReg
Optional subreg qualifier within Reg.
MachineBasicBlock * MBB
Block where this PHI was originally located.
bool operator<(const DebugSubstitution &Other) const
Order only by source instruction / operand pair: there should never be duplicate entries for the same...
DebugInstrOperandPair Dest
Replacement instruction / operand pair.
DebugInstrOperandPair Src
Source instruction / operand pair.
DebugSubstitution(const DebugInstrOperandPair &Src, const DebugInstrOperandPair &Dest, unsigned Subreg)
unsigned Subreg
Qualifier for which part of Dest is read.
virtual void MF_HandleChangeDesc(MachineInstr &MI, const MCInstrDesc &TID)
Callback before changing MCInstrDesc.
virtual void MF_HandleRemoval(MachineInstr &MI)=0
Callback before a removal. This should not modify the MI directly.
virtual void MF_HandleInsertion(MachineInstr &MI)=0
Callback after an insertion. This should not modify the MI directly.
virtual ~Delegate()=default
bool inStackSlot() const
Return true if this variable is in a stack slot.
void updateStackSlot(int NewSlot)
Updates the stack slot of this variable, assuming inStackSlot() is true.
MCRegister getEntryValueRegister() const
Returns the MCRegister of this variable, assuming inEntryValueRegister() is true.
bool inEntryValueRegister() const
Return true if this variable is in the entry value of a register.
const DILocalVariable * Var
VariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr, int Slot, const DILocation *Loc)
int getStackSlot() const
Returns the stack slot of this variable, assuming inStackSlot() is true.
const DIExpression * Expr
VariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr, MCRegister EntryValReg, const DILocation *Loc)
unsigned getInstructionCount() const
Return the number of MachineInstrs in this MachineFunction.
auto getEntryValueVariableDbgInfo() const
Returns the collection of variables for which we have debug info and that have been assigned an entry...
void setBBSectionsType(BasicBlockSection V)
MachineJumpTableInfo * getJumpTableInfo()
const WinEHFuncInfo * getWinEHFuncInfo() const
getWinEHFuncInfo - Return information about how the current function uses Windows exception handling.
void setCallsUnwindInit(bool b)
unsigned addToMBBNumbering(MachineBasicBlock *MBB)
Adds the MBB to the internal numbering.
void addLongjmpTarget(MCSymbol *Target)
Add the specified symbol to the list of valid longjmp targets for Windows Control Flow Guard.
const MachineConstantPool * getConstantPool() const
const MachineFrameInfo & getFrameInfo() const
void setHasEHFunclets(bool V)
bool UseDebugInstrRef
Flag for whether this function contains DBG_VALUEs (false) or DBG_INSTR_REF (true).
std::pair< unsigned, unsigned > DebugInstrOperandPair
Pair of instruction number and operand number.
ArrayRecycler< MachineOperand >::Capacity OperandCapacity
void addEHContTarget(MCSymbol *Target)
Add the specified symbol to the list of targets for Windows EH Continuation Guard.
bool useDebugInstrRef() const
Returns true if the function's variable locations are tracked with instruction referencing.
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,...
SmallVector< DebugSubstitution, 8 > DebugValueSubstitutions
Debug value substitutions: a collection of DebugSubstitution objects, recording changes in where a va...
unsigned getFunctionNumber() const
getFunctionNumber - Return a unique ID for the current function.
void setHasInlineAsm(bool B)
Set a flag that indicates that the function contains inline assembly.
bool hasAnyCallSiteLabel() const
CalledGlobalInfo tryGetCalledGlobal(const MachineInstr *MI) const
Tries to get the global and target flags for a call site, if the instruction is a call to a global.
PseudoSourceValueManager & getPSVManager() const
void substituteDebugValuesForInst(const MachineInstr &Old, MachineInstr &New, unsigned MaxOperand=UINT_MAX)
Create substitutions for any tracked values in Old, to point at New.
void setCallSiteBeginLabel(MCSymbol *BeginLabel, unsigned Site)
Map the begin label for a call site.
void setHasWinCFI(bool v)
void setWasmLandingPadIndex(const MachineBasicBlock *LPad, unsigned Index)
Map the landing pad to its index. Used for Wasm exception handling.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
const std::vector< MCCFIInstruction > & getFrameInstructions() const
Returns a reference to a list of cfi instructions in the function's prologue.
unsigned getNewDebugInstrNum()
DenseMap< const MachineInstr *, CallSiteInfo > CallSiteInfoMap
MachineFunction & operator=(const MachineFunction &)=delete
bool hasInlineAsm() const
Returns true if the function contains any inline assembly.
void setCallsEHReturn(bool b)
void makeDebugValueSubstitution(DebugInstrOperandPair, DebugInstrOperandPair, unsigned SubReg=0)
Create a substitution between one <instr,operand> value to a different, new value.
MachineFunction(Function &F, const TargetMachine &Target, const TargetSubtargetInfo &STI, MCContext &Ctx, unsigned FunctionNum)
BasicBlockListType::reverse_iterator reverse_iterator
void setAlignment(Align A)
setAlignment - Set the alignment of the function.
WinEHFuncInfo * getWinEHFuncInfo()
bool exposesReturnsTwice() const
exposesReturnsTwice - Returns true if the function calls setjmp or any other similar functions with a...
MachineFunctionProperties & getProperties()
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags F, TypeSize Size, Align BaseAlignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
GISelChangeObserver * getObserver() const
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
const std::vector< MCSymbol * > & getEHContTargets() const
Returns a reference to a list of symbols that are targets for Windows EH Continuation Guard.
void finalizeDebugInstrRefs()
Finalise any partially emitted debug instructions.
void deallocateOperandArray(OperandCapacity Cap, MachineOperand *Array)
Dellocate an array of MachineOperands and recycle the memory.
void setSection(MCSection *S)
Indicates the Section this function belongs to.
bool callsUnwindInit() const
MachineMemOperand * getMachineMemOperand(const MachineMemOperand *MMO, int64_t Offset, uint64_t Size)
void push_front(MachineBasicBlock *MBB)
const std::vector< unsigned > & getFilterIds() const
Return a reference to the typeids encoding filters used in the current function.
const std::vector< const GlobalValue * > & getTypeInfos() const
Return a reference to the C++ typeinfo for the current function.
auto getInStackSlotVariableDbgInfo() const
Returns the collection of variables for which we have debug info and that have been assigned a stack ...
bool hasAnyWasmLandingPadIndex() const
Return if there is any wasm exception handling.
const CallSiteInfoMap & getCallSitesInfo() const
void ensureAlignment(Align A)
ensureAlignment - Make sure the function is at least A bytes aligned.
void push_back(MachineBasicBlock *MBB)
reverse_iterator rbegin()
void setHasFakeUses(bool V)
void setUseDebugInstrRef(bool UseInstrRef)
Set whether this function will use instruction referencing or not.
bool hasBBSections() const
Returns true if this function has basic block sections enabled.
MCContext & getContext() const
bool callsEHReturn() const
void setVariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr, MCRegister Reg, const DILocation *Loc)
Collect information used to emit debugging information of a variable in the entry value of a register...
const Function & getFunction() const
Return the LLVM function that this machine code represents.
MachineOperand * allocateOperandArray(OperandCapacity Cap)
Allocate an array of MachineOperands.
MachineMemOperand * getMachineMemOperand(const MachineMemOperand *MMO, const MachinePointerInfo &PtrInfo, TypeSize Size)
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
MachineBasicBlock * getBlockNumbered(unsigned N) const
getBlockNumbered - MachineBasicBlocks are automatically numbered when they are inserted into the mach...
unsigned DebugInstrNumberingCount
A count of how many instructions in the function have had numbers assigned to them.
auto getInStackSlotVariableDbgInfo()
Returns the collection of variables for which we have debug info and that have been assigned a stack ...
Align getAlignment() const
getAlignment - Return the alignment of the function.
void splice(iterator InsertPt, iterator MBBI, iterator MBBE)
void handleChangeDesc(MachineInstr &MI, const MCInstrDesc &TID)
unsigned getWasmLandingPadIndex(const MachineBasicBlock *LPad) const
Get the index in wasm EH for a given landing pad.
const_iterator end() const
static const unsigned int DebugOperandMemNumber
A reserved operand number representing the instructions memory operand, for instructions that have a ...
void setObserver(GISelChangeObserver *O)
unsigned getBlockNumberEpoch() const
Return the numbering "epoch" of block numbers, incremented after each numbering.
void resetDelegate(Delegate *delegate)
Reset the currently registered delegate - otherwise assert.
void addCodeViewAnnotation(MCSymbol *Label, MDNode *MD)
Record annotations associated with a particular label.
Function & getFunction()
Return the LLVM function that this machine code represents.
MachineMemOperand * getMachineMemOperand(const MachineMemOperand *MMO, const MachinePointerInfo &PtrInfo, uint64_t Size)
void erase(MachineBasicBlock *MBBI)
unsigned getNumBlockIDs() const
getNumBlockIDs - Return the number of MBB ID's allocated.
const_iterator begin() const
void remove(MachineBasicBlock *MBBI)
void setIsOutlined(bool V)
const std::vector< MCSymbol * > & getLongjmpTargets() const
Returns a reference to a list of symbols immediately following calls to _setjmp in the function.
DebugInstrOperandPair salvageCopySSAImpl(MachineInstr &MI)
const std::vector< LandingPadInfo > & getLandingPads() const
Return a reference to the landing pad info for the current function.
MCSection * getSection() const
Returns the Section this function belongs to.
const VariableDbgInfoMapTy & getVariableDbgInfo() const
const MachineBasicBlock & back() const
BasicBlockListType::iterator iterator
void setDebugInstrNumberingCount(unsigned Num)
Set value of DebugInstrNumberingCount field.
const_reverse_iterator rbegin() const
const STC & getSubtarget() const
getSubtarget - This method returns a pointer to the specified type of TargetSubtargetInfo.
BasicBlockListType::const_reverse_iterator const_reverse_iterator
unsigned getCallSiteBeginLabel(MCSymbol *BeginLabel) const
Get the call site number for a begin label.
void remove(iterator MBBI)
VariableDbgInfoMapTy & getVariableDbgInfo()
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
MachineConstantPool * getConstantPool()
getConstantPool - Return the constant pool object for the current function.
const MachineRegisterInfo & getRegInfo() const
const WasmEHFuncInfo * getWasmEHFuncInfo() const
getWasmEHFuncInfo - Return information about how the current function uses Wasm exception handling.
bool hasCallSiteBeginLabel(MCSymbol *BeginLabel) const
Return true if the begin label has a call site number associated with it.
void splice(iterator InsertPt, MachineBasicBlock *MBB)
void addCallSiteInfo(const MachineInstr *CallI, CallSiteInfo &&CallInfo)
Start tracking the arguments passed to the call CallI.
static BasicBlockListType MachineFunction::* getSublistAccess(MachineBasicBlock *)
Support for MachineBasicBlock::getNextNode().
bool hasWasmLandingPadIndex(const MachineBasicBlock *LPad) const
Returns true if the landing pad has an associate index in wasm EH.
bool shouldUseDebugInstrRef() const
Determine whether, in the current machine configuration, we should use instruction referencing or not...
const MachineFunctionProperties & getProperties() const
Get the function properties.
Ty * cloneInfo(const Ty &Old)
bool hasCallSiteLandingPad(MCSymbol *Sym)
Return true if the landing pad Eh symbol has an associated call site.
void setVariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr, int Slot, const DILocation *Loc)
Collect information used to emit debugging information of a variable in a stack slot.
void setDelegate(Delegate *delegate)
Set the delegate.
void reset()
Reset the instance as if it was just created.
DenseMap< unsigned, DebugPHIRegallocPos > DebugPHIPositions
Map of debug instruction numbers to the position of their PHI instructions during register allocation...
const MachineBasicBlock & front() const
void setHasEHScopes(bool V)
MachineMemOperand * getMachineMemOperand(const MachineMemOperand *MMO, int64_t Offset, LocationSize Size)
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags F, uint64_t Size, Align BaseAlignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
const Ty * getInfo() const
bool hasEHFunclets() const
MachineMemOperand * getMachineMemOperand(const MachineMemOperand *MMO, int64_t Offset, TypeSize Size)
const MachineJumpTableInfo * getJumpTableInfo() const
getJumpTableInfo - Return the jump table info object for the current function.
const_reverse_iterator rend() const
void setHasEHContTarget(bool V)
bool hasAnyCallSiteLandingPad() const
WasmEHFuncInfo * getWasmEHFuncInfo()
void splice(iterator InsertPt, iterator MBBI)
SmallVector< VariableDbgInfo, 4 > VariableDbgInfoMapTy
auto getCalledGlobals() const
Iterates over the full set of call sites and their associated globals.
bool hasEHContTarget() const
void addCalledGlobal(const MachineInstr *MI, CalledGlobalInfo Details)
Notes the global and target flags for a call site.
void erase(iterator MBBI)
ArrayRef< std::pair< MCSymbol *, MDNode * > > getCodeViewAnnotations() const
VariableDbgInfoMapTy VariableDbgInfos
MachineFunction(const MachineFunction &)=delete
void insert(iterator MBBI, MachineBasicBlock *MBB)
MachineBasicBlock & back()
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
DebugInstrOperandPair salvageCopySSA(MachineInstr &MI, DenseMap< Register, DebugInstrOperandPair > &DbgPHICache)
Find the underlying defining instruction / operand for a COPY instruction while in SSA form.
BasicBlockListType::const_iterator const_iterator
MachineFunctionInfo * cloneInfoFrom(const MachineFunction &OrigMF, const DenseMap< MachineBasicBlock *, MachineBasicBlock * > &Src2DstMBB)
MachineBasicBlock & front()
SmallVectorImpl< unsigned > & getCallSiteLandingPad(MCSymbol *Sym)
Get the call site indexes for a landing pad EH symbol.
Representation of each machine instruction.
LLVM_ABI bool isCandidateForAdditionalCallInfo(QueryType Type=IgnoreBundle) const
Return true if this is a call instruction that may have an additional information associated with it.
A description of a memory reference used in the backend.
Flags
Flags values. These may be or'd together.
MachineOperand class - Representation of each machine instruction operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Pass interface - Implemented by all 'passes'.
Manages creation of pseudo source values.
Recycler - This class manages a linked-list of deallocated nodes and facilitates reusing deallocated ...
Wrapper class representing virtual and physical registers.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
Primary interface to the complete machine description for the target machine.
TargetSubtargetInfo - Generic base class for all target subtargets.
typename base_list_type::const_reverse_iterator const_reverse_iterator
typename base_list_type::reverse_iterator reverse_iterator
typename base_list_type::iterator iterator
typename base_list_type::const_iterator const_iterator
This class implements an extremely fast bulk output stream that can only output to a stream.
This file defines classes to implement an intrusive doubly linked list class (i.e.
@ Cold
Attempts to make code in the caller as efficient as possible under the assumption that the call is no...
@ System
Synchronized with respect to all concurrently executing threads.
This is an optimization pass for GlobalISel generic memory operations.
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
MachineFunctionDataHotness
iplist< T, Options... > ilist
LLVM_ABI void verifyMachineFunction(const std::string &Banner, const MachineFunction &MF)
iterator_range< filter_iterator< detail::IterOfRange< RangeT >, PredicateT > > make_filter_range(RangeT &&Range, PredicateT Pred)
Convenience function that takes a range of elements and a predicate, and return a new filter_iterator...
AtomicOrdering
Atomic ordering for LLVM's memory model.
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
This struct is a compact representation of a valid (non-zero power of two) alignment.
Represent subnormal handling kind for floating point instruction inputs and outputs.
static unsigned getNumberEpoch(MachineFunction *F)
static unsigned getMaxNumber(MachineFunction *F)
static NodeRef getEntryNode(Inverse< MachineFunction * > G)
static unsigned getNumberEpoch(const MachineFunction *F)
static unsigned getMaxNumber(const MachineFunction *F)
static NodeRef getEntryNode(Inverse< const MachineFunction * > G)
static unsigned getNumberEpoch(MachineFunction *F)
pointer_iterator< MachineFunction::iterator > nodes_iterator
static unsigned size(MachineFunction *F)
static nodes_iterator nodes_begin(MachineFunction *F)
static unsigned getMaxNumber(MachineFunction *F)
static nodes_iterator nodes_end(MachineFunction *F)
static NodeRef getEntryNode(MachineFunction *F)
static nodes_iterator nodes_begin(const MachineFunction *F)
pointer_iterator< MachineFunction::const_iterator > nodes_iterator
static nodes_iterator nodes_end(const MachineFunction *F)
static unsigned size(const MachineFunction *F)
static unsigned getMaxNumber(const MachineFunction *F)
static NodeRef getEntryNode(const MachineFunction *F)
static unsigned getNumberEpoch(const MachineFunction *F)
typename MachineFunction *::UnknownGraphTypeError NodeRef
This structure is used to retain landing pad info for the current function.
SmallVector< MCSymbol *, 1 > EndLabels
MCSymbol * LandingPadLabel
SmallVector< SEHHandler, 1 > SEHHandlers
LandingPadInfo(MachineBasicBlock *MBB)
MachineBasicBlock * LandingPadBlock
SmallVector< MCSymbol *, 1 > BeginLabels
std::vector< int > TypeIds
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
static FuncInfoTy * create(BumpPtrAllocator &Allocator, const Function &F, const SubtargetTy *STI)
Factory function: default behavior is to call new using the supplied allocator.
virtual ~MachineFunctionInfo()
virtual MachineFunctionInfo * clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF, const DenseMap< MachineBasicBlock *, MachineBasicBlock * > &Src2DstMBB) const
Make a functionally equivalent copy of this MachineFunctionInfo in MF.
static Ty * create(BumpPtrAllocator &Allocator, const Ty &MFI)
ArgRegPair(Register R, unsigned Arg)
SmallVector< ConstantInt *, 4 > CalleeTypeIds
Callee type ids.
SmallVector< ArgRegPair, 1 > ArgRegPairs
Vector of call argument and its forwarding register.
const GlobalValue * Callee
This class contains a discriminated union of information about pointers in memory operands,...
const BlockAddress * RecoverBA
Address of block to recover at. Null for a finally handler.
const Function * FilterOrFinally
Filter or finally function. Null indicates a catch-all.
LLVM_ABI void deleteNode(MachineBasicBlock *MBB)
Use delete by default for iplist and ilist.
void transferNodesFromList(ilist_callback_traits &OldList, Iterator, Iterator)
LLVM_ABI void removeNodeFromList(MachineBasicBlock *N)
LLVM_ABI void addNodeToList(MachineBasicBlock *N)
Callbacks do nothing by default in iplist and ilist.
Template traits for intrusive list.