LLVM 19.0.0git
MachineFunction.h
Go to the documentation of this file.
1//===- llvm/CodeGen/MachineFunction.h ---------------------------*- C++ -*-===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8//
9// Collect native machine code for a function. This class contains a list of
10// MachineBasicBlock instances that make up the current compiled function.
11//
12// This class also contains pointers to various classes which hold
13// target-specific information about the generated code.
14//
15//===----------------------------------------------------------------------===//
16
17#ifndef LLVM_CODEGEN_MACHINEFUNCTION_H
18#define LLVM_CODEGEN_MACHINEFUNCTION_H
19
20#include "llvm/ADT/ArrayRef.h"
21#include "llvm/ADT/BitVector.h"
22#include "llvm/ADT/DenseMap.h"
25#include "llvm/ADT/ilist.h"
26#include "llvm/ADT/iterator.h"
37#include <cassert>
38#include <cstdint>
39#include <memory>
40#include <utility>
41#include <variant>
42#include <vector>
43
44namespace llvm {
45
46class BasicBlock;
47class BlockAddress;
48class DataLayout;
49class DebugLoc;
50struct DenormalMode;
51class DIExpression;
52class DILocalVariable;
53class DILocation;
54class Function;
55class GISelChangeObserver;
56class GlobalValue;
57class LLVMTargetMachine;
58class MachineConstantPool;
59class MachineFrameInfo;
60class MachineFunction;
61class MachineJumpTableInfo;
62class MachineModuleInfo;
63class MachineRegisterInfo;
64class MCContext;
65class MCInstrDesc;
66class MCSymbol;
67class MCSection;
68class Pass;
69class PseudoSourceValueManager;
70class raw_ostream;
71class SlotIndexes;
72class StringRef;
73class TargetRegisterClass;
74class TargetSubtargetInfo;
75struct WasmEHFuncInfo;
76struct WinEHFuncInfo;
77
80};
81
85
86 template <class Iterator>
87 void transferNodesFromList(ilist_callback_traits &OldList, Iterator, Iterator) {
88 assert(this == &OldList && "never transfer MBBs between functions");
89 }
90};
91
92/// MachineFunctionInfo - This class can be derived from and used by targets to
93/// hold private target-specific information for each MachineFunction. Objects
94/// of type are accessed/created with MF::getInfo and destroyed when the
95/// MachineFunction is destroyed.
98
99 /// Factory function: default behavior is to call new using the
100 /// supplied allocator.
101 ///
102 /// This function can be overridden in a derive class.
103 template <typename FuncInfoTy, typename SubtargetTy = TargetSubtargetInfo>
104 static FuncInfoTy *create(BumpPtrAllocator &Allocator, const Function &F,
105 const SubtargetTy *STI) {
106 return new (Allocator.Allocate<FuncInfoTy>()) FuncInfoTy(F, STI);
107 }
108
109 template <typename Ty>
110 static Ty *create(BumpPtrAllocator &Allocator, const Ty &MFI) {
111 return new (Allocator.Allocate<Ty>()) Ty(MFI);
112 }
113
114 /// Make a functionally equivalent copy of this MachineFunctionInfo in \p MF.
115 /// This requires remapping MachineBasicBlock references from the original
116 /// parent to values in the new function. Targets may assume that virtual
117 /// register and frame index values are preserved in the new function.
118 virtual MachineFunctionInfo *
121 const {
122 return nullptr;
123 }
124};
125
126/// Properties which a MachineFunction may have at a given point in time.
127/// Each of these has checking code in the MachineVerifier, and passes can
128/// require that a property be set.
130 // Possible TODO: Allow targets to extend this (perhaps by allowing the
131 // constructor to specify the size of the bit vector)
132 // Possible TODO: Allow requiring the negative (e.g. VRegsAllocated could be
133 // stated as the negative of "has vregs"
134
135public:
136 // The properties are stated in "positive" form; i.e. a pass could require
137 // that the property hold, but not that it does not hold.
138
139 // Property descriptions:
140 // IsSSA: True when the machine function is in SSA form and virtual registers
141 // have a single def.
142 // NoPHIs: The machine function does not contain any PHI instruction.
143 // TracksLiveness: True when tracking register liveness accurately.
144 // While this property is set, register liveness information in basic block
145 // live-in lists and machine instruction operands (e.g. implicit defs) is
146 // accurate, kill flags are conservatively accurate (kill flag correctly
147 // indicates the last use of a register, an operand without kill flag may or
148 // may not be the last use of a register). This means it can be used to
149 // change the code in ways that affect the values in registers, for example
150 // by the register scavenger.
151 // When this property is cleared at a very late time, liveness is no longer
152 // reliable.
153 // NoVRegs: The machine function does not use any virtual registers.
154 // Legalized: In GlobalISel: the MachineLegalizer ran and all pre-isel generic
155 // instructions have been legalized; i.e., all instructions are now one of:
156 // - generic and always legal (e.g., COPY)
157 // - target-specific
158 // - legal pre-isel generic instructions.
159 // RegBankSelected: In GlobalISel: the RegBankSelect pass ran and all generic
160 // virtual registers have been assigned to a register bank.
161 // Selected: In GlobalISel: the InstructionSelect pass ran and all pre-isel
162 // generic instructions have been eliminated; i.e., all instructions are now
163 // target-specific or non-pre-isel generic instructions (e.g., COPY).
164 // Since only pre-isel generic instructions can have generic virtual register
165 // operands, this also means that all generic virtual registers have been
166 // constrained to virtual registers (assigned to register classes) and that
167 // all sizes attached to them have been eliminated.
168 // TiedOpsRewritten: The twoaddressinstruction pass will set this flag, it
169 // means that tied-def have been rewritten to meet the RegConstraint.
170 // FailsVerification: Means that the function is not expected to pass machine
171 // verification. This can be set by passes that introduce known problems that
172 // have not been fixed yet.
173 // TracksDebugUserValues: Without this property enabled, debug instructions
174 // such as DBG_VALUE are allowed to reference virtual registers even if those
175 // registers do not have a definition. With the property enabled virtual
176 // registers must only be used if they have a definition. This property
177 // allows earlier passes in the pipeline to skip updates of `DBG_VALUE`
178 // instructions to save compile time.
179 enum class Property : unsigned {
180 IsSSA,
181 NoPHIs,
183 NoVRegs,
185 Legalized,
187 Selected,
192 };
193
194 bool hasProperty(Property P) const {
195 return Properties[static_cast<unsigned>(P)];
196 }
197
199 Properties.set(static_cast<unsigned>(P));
200 return *this;
201 }
202
204 Properties.reset(static_cast<unsigned>(P));
205 return *this;
206 }
207
208 /// Reset all the properties.
210 Properties.reset();
211 return *this;
212 }
213
215 Properties |= MFP.Properties;
216 return *this;
217 }
218
220 Properties.reset(MFP.Properties);
221 return *this;
222 }
223
224 // Returns true if all properties set in V (i.e. required by a pass) are set
225 // in this.
227 return !V.Properties.test(Properties);
228 }
229
230 /// Print the MachineFunctionProperties in human-readable form.
231 void print(raw_ostream &OS) const;
232
233private:
234 BitVector Properties =
235 BitVector(static_cast<unsigned>(Property::LastProperty)+1);
236};
237
239 /// Filter or finally function. Null indicates a catch-all.
241
242 /// Address of block to recover at. Null for a finally handler.
244};
245
246/// This structure is used to retain landing pad info for the current function.
248 MachineBasicBlock *LandingPadBlock; // Landing pad block.
249 SmallVector<MCSymbol *, 1> BeginLabels; // Labels prior to invoke.
250 SmallVector<MCSymbol *, 1> EndLabels; // Labels after invoke.
251 SmallVector<SEHHandler, 1> SEHHandlers; // SEH handlers active at this lpad.
252 MCSymbol *LandingPadLabel = nullptr; // Label at beginning of landing pad.
253 std::vector<int> TypeIds; // List of type ids (filters negative).
254
256 : LandingPadBlock(MBB) {}
257};
258
260 Function &F;
262 const TargetSubtargetInfo *STI;
263 MCContext &Ctx;
265
266 // RegInfo - Information about each register in use in the function.
268
269 // Used to keep track of target-specific per-machine-function information for
270 // the target implementation.
271 MachineFunctionInfo *MFInfo;
272
273 // Keep track of objects allocated on the stack.
274 MachineFrameInfo *FrameInfo;
275
276 // Keep track of constants which are spilled to memory
278
279 // Keep track of jump tables for switch instructions
280 MachineJumpTableInfo *JumpTableInfo;
281
282 // Keep track of the function section.
283 MCSection *Section = nullptr;
284
285 // Catchpad unwind destination info for wasm EH.
286 // Keeps track of Wasm exception handling related data. This will be null for
287 // functions that aren't using a wasm EH personality.
288 WasmEHFuncInfo *WasmEHInfo = nullptr;
289
290 // Keeps track of Windows exception handling related data. This will be null
291 // for functions that aren't using a funclet-based EH personality.
292 WinEHFuncInfo *WinEHInfo = nullptr;
293
294 // Function-level unique numbering for MachineBasicBlocks. When a
295 // MachineBasicBlock is inserted into a MachineFunction is it automatically
296 // numbered and this vector keeps track of the mapping from ID's to MBB's.
297 std::vector<MachineBasicBlock*> MBBNumbering;
298
299 // Pool-allocate MachineFunction-lifetime and IR objects.
301
302 // Allocation management for instructions in function.
303 Recycler<MachineInstr> InstructionRecycler;
304
305 // Allocation management for operand arrays on instructions.
306 ArrayRecycler<MachineOperand> OperandRecycler;
307
308 // Allocation management for basic blocks in function.
309 Recycler<MachineBasicBlock> BasicBlockRecycler;
310
311 // List of machine basic blocks in function
313 BasicBlockListType BasicBlocks;
314
315 /// FunctionNumber - This provides a unique ID for each function emitted in
316 /// this translation unit.
317 ///
318 unsigned FunctionNumber;
319
320 /// Alignment - The alignment of the function.
321 Align Alignment;
322
323 /// ExposesReturnsTwice - True if the function calls setjmp or related
324 /// functions with attribute "returns twice", but doesn't have
325 /// the attribute itself.
326 /// This is used to limit optimizations which cannot reason
327 /// about the control flow of such functions.
328 bool ExposesReturnsTwice = false;
329
330 /// True if the function includes any inline assembly.
331 bool HasInlineAsm = false;
332
333 /// True if any WinCFI instruction have been emitted in this function.
334 bool HasWinCFI = false;
335
336 /// Current high-level properties of the IR of the function (e.g. is in SSA
337 /// form or whether registers have been allocated)
338 MachineFunctionProperties Properties;
339
340 // Allocation management for pseudo source values.
341 std::unique_ptr<PseudoSourceValueManager> PSVManager;
342
343 /// List of moves done by a function's prolog. Used to construct frame maps
344 /// by debug and exception handling consumers.
345 std::vector<MCCFIInstruction> FrameInstructions;
346
347 /// List of basic blocks immediately following calls to _setjmp. Used to
348 /// construct a table of valid longjmp targets for Windows Control Flow Guard.
349 std::vector<MCSymbol *> LongjmpTargets;
350
351 /// List of basic blocks that are the target of catchrets. Used to construct
352 /// a table of valid targets for Windows EHCont Guard.
353 std::vector<MCSymbol *> CatchretTargets;
354
355 /// \name Exception Handling
356 /// \{
357
358 /// List of LandingPadInfo describing the landing pad information.
359 std::vector<LandingPadInfo> LandingPads;
360
361 /// Map a landing pad's EH symbol to the call site indexes.
363
364 /// Map a landing pad to its index.
366
367 /// Map of invoke call site index values to associated begin EH_LABEL.
369
370 /// CodeView label annotations.
371 std::vector<std::pair<MCSymbol *, MDNode *>> CodeViewAnnotations;
372
373 bool CallsEHReturn = false;
374 bool CallsUnwindInit = false;
375 bool HasEHCatchret = false;
376 bool HasEHScopes = false;
377 bool HasEHFunclets = false;
378 bool IsOutlined = false;
379
380 /// BBID to assign to the next basic block of this function.
381 unsigned NextBBID = 0;
382
383 /// Section Type for basic blocks, only relevant with basic block sections.
384 BasicBlockSection BBSectionsType = BasicBlockSection::None;
385
386 /// List of C++ TypeInfo used.
387 std::vector<const GlobalValue *> TypeInfos;
388
389 /// List of typeids encoding filters used.
390 std::vector<unsigned> FilterIds;
391
392 /// List of the indices in FilterIds corresponding to filter terminators.
393 std::vector<unsigned> FilterEnds;
394
395 EHPersonality PersonalityTypeCache = EHPersonality::Unknown;
396
397 /// \}
398
399 /// Clear all the members of this MachineFunction, but the ones used
400 /// to initialize again the MachineFunction.
401 /// More specifically, this deallocates all the dynamically allocated
402 /// objects and get rid of all the XXXInfo data structure, but keep
403 /// unchanged the references to Fn, Target, MMI, and FunctionNumber.
404 void clear();
405 /// Allocate and initialize the different members.
406 /// In particular, the XXXInfo data structure.
407 /// \pre Fn, Target, MMI, and FunctionNumber are properly set.
408 void init();
409
410public:
411 /// Description of the location of a variable whose Address is valid and
412 /// unchanging during function execution. The Address may be:
413 /// * A stack index, which can be negative for fixed stack objects.
414 /// * A MCRegister, whose entry value contains the address of the variable.
416 std::variant<int, MCRegister> Address;
417
418 public:
422
424 int Slot, const DILocation *Loc)
425 : Address(Slot), Var(Var), Expr(Expr), Loc(Loc) {}
426
428 MCRegister EntryValReg, const DILocation *Loc)
429 : Address(EntryValReg), Var(Var), Expr(Expr), Loc(Loc) {}
430
431 /// Return true if this variable is in a stack slot.
432 bool inStackSlot() const { return std::holds_alternative<int>(Address); }
433
434 /// Return true if this variable is in the entry value of a register.
435 bool inEntryValueRegister() const {
436 return std::holds_alternative<MCRegister>(Address);
437 }
438
439 /// Returns the stack slot of this variable, assuming `inStackSlot()` is
440 /// true.
441 int getStackSlot() const { return std::get<int>(Address); }
442
443 /// Returns the MCRegister of this variable, assuming
444 /// `inEntryValueRegister()` is true.
446 return std::get<MCRegister>(Address);
447 }
448
449 /// Updates the stack slot of this variable, assuming `inStackSlot()` is
450 /// true.
451 void updateStackSlot(int NewSlot) {
452 assert(inStackSlot());
453 Address = NewSlot;
454 }
455 };
456
457 class Delegate {
458 virtual void anchor();
459
460 public:
461 virtual ~Delegate() = default;
462 /// Callback after an insertion. This should not modify the MI directly.
464 /// Callback before a removal. This should not modify the MI directly.
465 virtual void MF_HandleRemoval(MachineInstr &MI) = 0;
466 /// Callback before changing MCInstrDesc. This should not modify the MI
467 /// directly.
468 virtual void MF_HandleChangeDesc(MachineInstr &MI, const MCInstrDesc &TID) {
469 return;
470 }
471 };
472
473 /// Structure used to represent pair of argument number after call lowering
474 /// and register used to transfer that argument.
475 /// For now we support only cases when argument is transferred through one
476 /// register.
477 struct ArgRegPair {
480 ArgRegPair(Register R, unsigned Arg) : Reg(R), ArgNo(Arg) {
481 assert(Arg < (1 << 16) && "Arg out of range");
482 }
483 };
484 /// Vector of call argument and its forwarding register.
487
488private:
489 Delegate *TheDelegate = nullptr;
490 GISelChangeObserver *Observer = nullptr;
491
493 /// Map a call instruction to call site arguments forwarding info.
494 CallSiteInfoMap CallSitesInfo;
495
496 /// A helper function that returns call site info for a give call
497 /// instruction if debug entry value support is enabled.
498 CallSiteInfoMap::iterator getCallSiteInfo(const MachineInstr *MI);
499
500 // Callbacks for insertion and removal.
501 void handleInsertion(MachineInstr &MI);
502 void handleRemoval(MachineInstr &MI);
503 friend struct ilist_traits<MachineInstr>;
504
505public:
506 // Need to be accessed from MachineInstr::setDesc.
507 void handleChangeDesc(MachineInstr &MI, const MCInstrDesc &TID);
508
511
512 /// A count of how many instructions in the function have had numbers
513 /// assigned to them. Used for debug value tracking, to determine the
514 /// next instruction number.
515 unsigned DebugInstrNumberingCount = 0;
516
517 /// Set value of DebugInstrNumberingCount field. Avoid using this unless
518 /// you're deserializing this data.
519 void setDebugInstrNumberingCount(unsigned Num);
520
521 /// Pair of instruction number and operand number.
522 using DebugInstrOperandPair = std::pair<unsigned, unsigned>;
523
524 /// Replacement definition for a debug instruction reference. Made up of a
525 /// source instruction / operand pair, destination pair, and a qualifying
526 /// subregister indicating what bits in the operand make up the substitution.
527 // For example, a debug user
528 /// of %1:
529 /// %0:gr32 = someinst, debug-instr-number 1
530 /// %1:gr16 = %0.some_16_bit_subreg, debug-instr-number 2
531 /// Would receive the substitution {{2, 0}, {1, 0}, $subreg}, where $subreg is
532 /// the subregister number for some_16_bit_subreg.
534 public:
535 DebugInstrOperandPair Src; ///< Source instruction / operand pair.
536 DebugInstrOperandPair Dest; ///< Replacement instruction / operand pair.
537 unsigned Subreg; ///< Qualifier for which part of Dest is read.
538
540 const DebugInstrOperandPair &Dest, unsigned Subreg)
541 : Src(Src), Dest(Dest), Subreg(Subreg) {}
542
543 /// Order only by source instruction / operand pair: there should never
544 /// be duplicate entries for the same source in any collection.
545 bool operator<(const DebugSubstitution &Other) const {
546 return Src < Other.Src;
547 }
548 };
549
550 /// Debug value substitutions: a collection of DebugSubstitution objects,
551 /// recording changes in where a value is defined. For example, when one
552 /// instruction is substituted for another. Keeping a record allows recovery
553 /// of variable locations after compilation finishes.
555
556 /// Location of a PHI instruction that is also a debug-info variable value,
557 /// for the duration of register allocation. Loaded by the PHI-elimination
558 /// pass, and emitted as DBG_PHI instructions during VirtRegRewriter, with
559 /// maintenance applied by intermediate passes that edit registers (such as
560 /// coalescing and the allocator passes).
562 public:
563 MachineBasicBlock *MBB; ///< Block where this PHI was originally located.
564 Register Reg; ///< VReg where the control-flow-merge happens.
565 unsigned SubReg; ///< Optional subreg qualifier within Reg.
567 : MBB(MBB), Reg(Reg), SubReg(SubReg) {}
568 };
569
570 /// Map of debug instruction numbers to the position of their PHI instructions
571 /// during register allocation. See DebugPHIRegallocPos.
573
574 /// Flag for whether this function contains DBG_VALUEs (false) or
575 /// DBG_INSTR_REF (true).
576 bool UseDebugInstrRef = false;
577
578 /// Create a substitution between one <instr,operand> value to a different,
579 /// new value.
580 void makeDebugValueSubstitution(DebugInstrOperandPair, DebugInstrOperandPair,
581 unsigned SubReg = 0);
582
583 /// Create substitutions for any tracked values in \p Old, to point at
584 /// \p New. Needed when we re-create an instruction during optimization,
585 /// which has the same signature (i.e., def operands in the same place) but
586 /// a modified instruction type, flags, or otherwise. An example: X86 moves
587 /// are sometimes transformed into equivalent LEAs.
588 /// If the two instructions are not the same opcode, limit which operands to
589 /// examine for substitutions to the first N operands by setting
590 /// \p MaxOperand.
591 void substituteDebugValuesForInst(const MachineInstr &Old, MachineInstr &New,
592 unsigned MaxOperand = UINT_MAX);
593
594 /// Find the underlying defining instruction / operand for a COPY instruction
595 /// while in SSA form. Copies do not actually define values -- they move them
596 /// between registers. Labelling a COPY-like instruction with an instruction
597 /// number is to be avoided as it makes value numbers non-unique later in
598 /// compilation. This method follows the definition chain for any sequence of
599 /// COPY-like instructions to find whatever non-COPY-like instruction defines
600 /// the copied value; or for parameters, creates a DBG_PHI on entry.
601 /// May insert instructions into the entry block!
602 /// \p MI The copy-like instruction to salvage.
603 /// \p DbgPHICache A container to cache already-solved COPYs.
604 /// \returns An instruction/operand pair identifying the defining value.
606 salvageCopySSA(MachineInstr &MI,
608
609 DebugInstrOperandPair salvageCopySSAImpl(MachineInstr &MI);
610
611 /// Finalise any partially emitted debug instructions. These are DBG_INSTR_REF
612 /// instructions where we only knew the vreg of the value they use, not the
613 /// instruction that defines that vreg. Once isel finishes, we should have
614 /// enough information for every DBG_INSTR_REF to point at an instruction
615 /// (or DBG_PHI).
616 void finalizeDebugInstrRefs();
617
618 /// Determine whether, in the current machine configuration, we should use
619 /// instruction referencing or not.
620 bool shouldUseDebugInstrRef() const;
621
622 /// Returns true if the function's variable locations are tracked with
623 /// instruction referencing.
624 bool useDebugInstrRef() const;
625
626 /// Set whether this function will use instruction referencing or not.
627 void setUseDebugInstrRef(bool UseInstrRef);
628
629 /// A reserved operand number representing the instructions memory operand,
630 /// for instructions that have a stack spill fused into them.
631 const static unsigned int DebugOperandMemNumber;
632
634 const TargetSubtargetInfo &STI, unsigned FunctionNum,
635 MachineModuleInfo &MMI);
639
640 /// Reset the instance as if it was just created.
641 void reset() {
642 clear();
643 init();
644 }
645
646 /// Reset the currently registered delegate - otherwise assert.
647 void resetDelegate(Delegate *delegate) {
648 assert(TheDelegate == delegate &&
649 "Only the current delegate can perform reset!");
650 TheDelegate = nullptr;
651 }
652
653 /// Set the delegate. resetDelegate must be called before attempting
654 /// to set.
655 void setDelegate(Delegate *delegate) {
656 assert(delegate && !TheDelegate &&
657 "Attempted to set delegate to null, or to change it without "
658 "first resetting it!");
659
660 TheDelegate = delegate;
661 }
662
663 void setObserver(GISelChangeObserver *O) { Observer = O; }
664
665 GISelChangeObserver *getObserver() const { return Observer; }
666
667 MachineModuleInfo &getMMI() const { return MMI; }
668 MCContext &getContext() const { return Ctx; }
669
670 /// Returns the Section this function belongs to.
671 MCSection *getSection() const { return Section; }
672
673 /// Indicates the Section this function belongs to.
674 void setSection(MCSection *S) { Section = S; }
675
676 PseudoSourceValueManager &getPSVManager() const { return *PSVManager; }
677
678 /// Return the DataLayout attached to the Module associated to this MF.
679 const DataLayout &getDataLayout() const;
680
681 /// Return the LLVM function that this machine code represents
682 Function &getFunction() { return F; }
683
684 /// Return the LLVM function that this machine code represents
685 const Function &getFunction() const { return F; }
686
687 /// getName - Return the name of the corresponding LLVM function.
688 StringRef getName() const;
689
690 /// getFunctionNumber - Return a unique ID for the current function.
691 unsigned getFunctionNumber() const { return FunctionNumber; }
692
693 /// Returns true if this function has basic block sections enabled.
694 bool hasBBSections() const {
695 return (BBSectionsType == BasicBlockSection::All ||
696 BBSectionsType == BasicBlockSection::List ||
697 BBSectionsType == BasicBlockSection::Preset);
698 }
699
700 /// Returns true if basic block labels are to be generated for this function.
701 bool hasBBLabels() const {
702 return BBSectionsType == BasicBlockSection::Labels;
703 }
704
705 void setBBSectionsType(BasicBlockSection V) { BBSectionsType = V; }
706
707 /// Assign IsBeginSection IsEndSection fields for basic blocks in this
708 /// function.
709 void assignBeginEndSections();
710
711 /// getTarget - Return the target machine this machine code is compiled with
712 const LLVMTargetMachine &getTarget() const { return Target; }
713
714 /// getSubtarget - Return the subtarget for which this machine code is being
715 /// compiled.
716 const TargetSubtargetInfo &getSubtarget() const { return *STI; }
717
718 /// getSubtarget - This method returns a pointer to the specified type of
719 /// TargetSubtargetInfo. In debug builds, it verifies that the object being
720 /// returned is of the correct type.
721 template<typename STC> const STC &getSubtarget() const {
722 return *static_cast<const STC *>(STI);
723 }
724
725 /// getRegInfo - Return information about the registers currently in use.
727 const MachineRegisterInfo &getRegInfo() const { return *RegInfo; }
728
729 /// getFrameInfo - Return the frame info object for the current function.
730 /// This object contains information about objects allocated on the stack
731 /// frame of the current function in an abstract way.
732 MachineFrameInfo &getFrameInfo() { return *FrameInfo; }
733 const MachineFrameInfo &getFrameInfo() const { return *FrameInfo; }
734
735 /// getJumpTableInfo - Return the jump table info object for the current
736 /// function. This object contains information about jump tables in the
737 /// current function. If the current function has no jump tables, this will
738 /// return null.
739 const MachineJumpTableInfo *getJumpTableInfo() const { return JumpTableInfo; }
740 MachineJumpTableInfo *getJumpTableInfo() { return JumpTableInfo; }
741
742 /// getOrCreateJumpTableInfo - Get the JumpTableInfo for this function, if it
743 /// does already exist, allocate one.
744 MachineJumpTableInfo *getOrCreateJumpTableInfo(unsigned JTEntryKind);
745
746 /// getConstantPool - Return the constant pool object for the current
747 /// function.
750
751 /// getWasmEHFuncInfo - Return information about how the current function uses
752 /// Wasm exception handling. Returns null for functions that don't use wasm
753 /// exception handling.
754 const WasmEHFuncInfo *getWasmEHFuncInfo() const { return WasmEHInfo; }
755 WasmEHFuncInfo *getWasmEHFuncInfo() { return WasmEHInfo; }
756
757 /// getWinEHFuncInfo - Return information about how the current function uses
758 /// Windows exception handling. Returns null for functions that don't use
759 /// funclets for exception handling.
760 const WinEHFuncInfo *getWinEHFuncInfo() const { return WinEHInfo; }
761 WinEHFuncInfo *getWinEHFuncInfo() { return WinEHInfo; }
762
763 /// getAlignment - Return the alignment of the function.
764 Align getAlignment() const { return Alignment; }
765
766 /// setAlignment - Set the alignment of the function.
767 void setAlignment(Align A) { Alignment = A; }
768
769 /// ensureAlignment - Make sure the function is at least A bytes aligned.
771 if (Alignment < A)
772 Alignment = A;
773 }
774
775 /// exposesReturnsTwice - Returns true if the function calls setjmp or
776 /// any other similar functions with attribute "returns twice" without
777 /// having the attribute itself.
778 bool exposesReturnsTwice() const {
779 return ExposesReturnsTwice;
780 }
781
782 /// setCallsSetJmp - Set a flag that indicates if there's a call to
783 /// a "returns twice" function.
785 ExposesReturnsTwice = B;
786 }
787
788 /// Returns true if the function contains any inline assembly.
789 bool hasInlineAsm() const {
790 return HasInlineAsm;
791 }
792
793 /// Set a flag that indicates that the function contains inline assembly.
794 void setHasInlineAsm(bool B) {
795 HasInlineAsm = B;
796 }
797
798 bool hasWinCFI() const {
799 return HasWinCFI;
800 }
801 void setHasWinCFI(bool v) { HasWinCFI = v; }
802
803 /// True if this function needs frame moves for debug or exceptions.
804 bool needsFrameMoves() const;
805
806 /// Get the function properties
807 const MachineFunctionProperties &getProperties() const { return Properties; }
808 MachineFunctionProperties &getProperties() { return Properties; }
809
810 /// getInfo - Keep track of various per-function pieces of information for
811 /// backends that would like to do so.
812 ///
813 template<typename Ty>
814 Ty *getInfo() {
815 return static_cast<Ty*>(MFInfo);
816 }
817
818 template<typename Ty>
819 const Ty *getInfo() const {
820 return static_cast<const Ty *>(MFInfo);
821 }
822
823 template <typename Ty> Ty *cloneInfo(const Ty &Old) {
824 assert(!MFInfo);
825 MFInfo = Ty::template create<Ty>(Allocator, Old);
826 return static_cast<Ty *>(MFInfo);
827 }
828
829 /// Initialize the target specific MachineFunctionInfo
830 void initTargetMachineFunctionInfo(const TargetSubtargetInfo &STI);
831
833 const MachineFunction &OrigMF,
835 assert(!MFInfo && "new function already has MachineFunctionInfo");
836 if (!OrigMF.MFInfo)
837 return nullptr;
838 return OrigMF.MFInfo->clone(Allocator, *this, Src2DstMBB);
839 }
840
841 /// Returns the denormal handling type for the default rounding mode of the
842 /// function.
843 DenormalMode getDenormalMode(const fltSemantics &FPType) const;
844
845 /// getBlockNumbered - MachineBasicBlocks are automatically numbered when they
846 /// are inserted into the machine function. The block number for a machine
847 /// basic block can be found by using the MBB::getNumber method, this method
848 /// provides the inverse mapping.
850 assert(N < MBBNumbering.size() && "Illegal block number");
851 assert(MBBNumbering[N] && "Block was removed from the machine function!");
852 return MBBNumbering[N];
853 }
854
855 /// Should we be emitting segmented stack stuff for the function
856 bool shouldSplitStack() const;
857
858 /// getNumBlockIDs - Return the number of MBB ID's allocated.
859 unsigned getNumBlockIDs() const { return (unsigned)MBBNumbering.size(); }
860
861 /// RenumberBlocks - This discards all of the MachineBasicBlock numbers and
862 /// recomputes them. This guarantees that the MBB numbers are sequential,
863 /// dense, and match the ordering of the blocks within the function. If a
864 /// specific MachineBasicBlock is specified, only that block and those after
865 /// it are renumbered.
866 void RenumberBlocks(MachineBasicBlock *MBBFrom = nullptr);
867
868 /// print - Print out the MachineFunction in a format suitable for debugging
869 /// to the specified stream.
870 void print(raw_ostream &OS, const SlotIndexes* = nullptr) const;
871
872 /// viewCFG - This function is meant for use from the debugger. You can just
873 /// say 'call F->viewCFG()' and a ghostview window should pop up from the
874 /// program, displaying the CFG of the current function with the code for each
875 /// basic block inside. This depends on there being a 'dot' and 'gv' program
876 /// in your path.
877 void viewCFG() const;
878
879 /// viewCFGOnly - This function is meant for use from the debugger. It works
880 /// just like viewCFG, but it does not include the contents of basic blocks
881 /// into the nodes, just the label. If you are only interested in the CFG
882 /// this can make the graph smaller.
883 ///
884 void viewCFGOnly() const;
885
886 /// dump - Print the current MachineFunction to cerr, useful for debugger use.
887 void dump() const;
888
889 /// Run the current MachineFunction through the machine code verifier, useful
890 /// for debugger use.
891 /// \returns true if no problems were found.
892 bool verify(Pass *p = nullptr, const char *Banner = nullptr,
893 bool AbortOnError = true) const;
894
895 /// Run the current MachineFunction through the machine code verifier, useful
896 /// for debugger use.
897 /// \returns true if no problems were found.
898 bool verify(LiveIntervals *LiveInts, SlotIndexes *Indexes,
899 const char *Banner = nullptr, bool AbortOnError = true) const;
900
901 // Provide accessors for the MachineBasicBlock list...
906
907 /// Support for MachineBasicBlock::getNextNode().
910 return &MachineFunction::BasicBlocks;
911 }
912
913 /// addLiveIn - Add the specified physical register as a live-in value and
914 /// create a corresponding virtual register for it.
916
917 //===--------------------------------------------------------------------===//
918 // BasicBlock accessor functions.
919 //
920 iterator begin() { return BasicBlocks.begin(); }
921 const_iterator begin() const { return BasicBlocks.begin(); }
922 iterator end () { return BasicBlocks.end(); }
923 const_iterator end () const { return BasicBlocks.end(); }
924
925 reverse_iterator rbegin() { return BasicBlocks.rbegin(); }
926 const_reverse_iterator rbegin() const { return BasicBlocks.rbegin(); }
927 reverse_iterator rend () { return BasicBlocks.rend(); }
928 const_reverse_iterator rend () const { return BasicBlocks.rend(); }
929
930 unsigned size() const { return (unsigned)BasicBlocks.size();}
931 bool empty() const { return BasicBlocks.empty(); }
932 const MachineBasicBlock &front() const { return BasicBlocks.front(); }
933 MachineBasicBlock &front() { return BasicBlocks.front(); }
934 const MachineBasicBlock & back() const { return BasicBlocks.back(); }
935 MachineBasicBlock & back() { return BasicBlocks.back(); }
936
937 void push_back (MachineBasicBlock *MBB) { BasicBlocks.push_back (MBB); }
940 BasicBlocks.insert(MBBI, MBB);
941 }
942 void splice(iterator InsertPt, iterator MBBI) {
943 BasicBlocks.splice(InsertPt, BasicBlocks, MBBI);
944 }
946 BasicBlocks.splice(InsertPt, BasicBlocks, MBB);
947 }
948 void splice(iterator InsertPt, iterator MBBI, iterator MBBE) {
949 BasicBlocks.splice(InsertPt, BasicBlocks, MBBI, MBBE);
950 }
951
952 void remove(iterator MBBI) { BasicBlocks.remove(MBBI); }
953 void remove(MachineBasicBlock *MBBI) { BasicBlocks.remove(MBBI); }
954 void erase(iterator MBBI) { BasicBlocks.erase(MBBI); }
955 void erase(MachineBasicBlock *MBBI) { BasicBlocks.erase(MBBI); }
956
957 template <typename Comp>
958 void sort(Comp comp) {
959 BasicBlocks.sort(comp);
960 }
961
962 /// Return the number of \p MachineInstrs in this \p MachineFunction.
963 unsigned getInstructionCount() const {
964 unsigned InstrCount = 0;
965 for (const MachineBasicBlock &MBB : BasicBlocks)
966 InstrCount += MBB.size();
967 return InstrCount;
968 }
969
970 //===--------------------------------------------------------------------===//
971 // Internal functions used to automatically number MachineBasicBlocks
972
973 /// Adds the MBB to the internal numbering. Returns the unique number
974 /// assigned to the MBB.
976 MBBNumbering.push_back(MBB);
977 return (unsigned)MBBNumbering.size()-1;
978 }
979
980 /// removeFromMBBNumbering - Remove the specific machine basic block from our
981 /// tracker, this is only really to be used by the MachineBasicBlock
982 /// implementation.
983 void removeFromMBBNumbering(unsigned N) {
984 assert(N < MBBNumbering.size() && "Illegal basic block #");
985 MBBNumbering[N] = nullptr;
986 }
987
988 /// CreateMachineInstr - Allocate a new MachineInstr. Use this instead
989 /// of `new MachineInstr'.
990 MachineInstr *CreateMachineInstr(const MCInstrDesc &MCID, DebugLoc DL,
991 bool NoImplicit = false);
992
993 /// Create a new MachineInstr which is a copy of \p Orig, identical in all
994 /// ways except the instruction has no parent, prev, or next. Bundling flags
995 /// are reset.
996 ///
997 /// Note: Clones a single instruction, not whole instruction bundles.
998 /// Does not perform target specific adjustments; consider using
999 /// TargetInstrInfo::duplicate() instead.
1000 MachineInstr *CloneMachineInstr(const MachineInstr *Orig);
1001
1002 /// Clones instruction or the whole instruction bundle \p Orig and insert
1003 /// into \p MBB before \p InsertBefore.
1004 ///
1005 /// Note: Does not perform target specific adjustments; consider using
1006 /// TargetInstrInfo::duplicate() intead.
1007 MachineInstr &
1008 cloneMachineInstrBundle(MachineBasicBlock &MBB,
1009 MachineBasicBlock::iterator InsertBefore,
1010 const MachineInstr &Orig);
1011
1012 /// DeleteMachineInstr - Delete the given MachineInstr.
1013 void deleteMachineInstr(MachineInstr *MI);
1014
1015 /// CreateMachineBasicBlock - Allocate a new MachineBasicBlock. Use this
1016 /// instead of `new MachineBasicBlock'. Sets `MachineBasicBlock::BBID` if
1017 /// basic-block-sections is enabled for the function.
1019 CreateMachineBasicBlock(const BasicBlock *BB = nullptr,
1020 std::optional<UniqueBBID> BBID = std::nullopt);
1021
1022 /// DeleteMachineBasicBlock - Delete the given MachineBasicBlock.
1023 void deleteMachineBasicBlock(MachineBasicBlock *MBB);
1024
1025 /// getMachineMemOperand - Allocate a new MachineMemOperand.
1026 /// MachineMemOperands are owned by the MachineFunction and need not be
1027 /// explicitly deallocated.
1030 Align base_alignment, const AAMDNodes &AAInfo = AAMDNodes(),
1031 const MDNode *Ranges = nullptr, SyncScope::ID SSID = SyncScope::System,
1032 AtomicOrdering Ordering = AtomicOrdering::NotAtomic,
1033 AtomicOrdering FailureOrdering = AtomicOrdering::NotAtomic);
1036 Align BaseAlignment, const AAMDNodes &AAInfo = AAMDNodes(),
1037 const MDNode *Ranges = nullptr, SyncScope::ID SSID = SyncScope::System,
1038 AtomicOrdering Ordering = AtomicOrdering::NotAtomic,
1039 AtomicOrdering FailureOrdering = AtomicOrdering::NotAtomic);
1042 Align BaseAlignment, const AAMDNodes &AAInfo = AAMDNodes(),
1043 const MDNode *Ranges = nullptr, SyncScope::ID SSID = SyncScope::System,
1044 AtomicOrdering Ordering = AtomicOrdering::NotAtomic,
1045 AtomicOrdering FailureOrdering = AtomicOrdering::NotAtomic) {
1046 return getMachineMemOperand(PtrInfo, F, LocationSize::precise(Size),
1047 BaseAlignment, AAInfo, Ranges, SSID, Ordering,
1048 FailureOrdering);
1049 }
1050
1051 /// getMachineMemOperand - Allocate a new MachineMemOperand by copying
1052 /// an existing one, adjusting by an offset and using the given size.
1053 /// MachineMemOperands are owned by the MachineFunction and need not be
1054 /// explicitly deallocated.
1056 int64_t Offset, LLT Ty);
1058 int64_t Offset, LocationSize Size) {
1059 return getMachineMemOperand(
1060 MMO, Offset,
1061 !Size.hasValue() || Size.isScalable()
1062 ? LLT()
1063 : LLT::scalar(8 * Size.getValue().getKnownMinValue()));
1064 }
1066 int64_t Offset, uint64_t Size) {
1067 return getMachineMemOperand(MMO, Offset, LocationSize::precise(Size));
1068 }
1069
1070 /// getMachineMemOperand - Allocate a new MachineMemOperand by copying
1071 /// an existing one, replacing only the MachinePointerInfo and size.
1072 /// MachineMemOperands are owned by the MachineFunction and need not be
1073 /// explicitly deallocated.
1075 const MachinePointerInfo &PtrInfo,
1078 const MachinePointerInfo &PtrInfo,
1079 LLT Ty);
1081 const MachinePointerInfo &PtrInfo,
1082 uint64_t Size) {
1083 return getMachineMemOperand(MMO, PtrInfo, LocationSize::precise(Size));
1084 }
1085
1086 /// Allocate a new MachineMemOperand by copying an existing one,
1087 /// replacing only AliasAnalysis information. MachineMemOperands are owned
1088 /// by the MachineFunction and need not be explicitly deallocated.
1090 const AAMDNodes &AAInfo);
1091
1092 /// Allocate a new MachineMemOperand by copying an existing one,
1093 /// replacing the flags. MachineMemOperands are owned
1094 /// by the MachineFunction and need not be explicitly deallocated.
1097
1099
1100 /// Allocate an array of MachineOperands. This is only intended for use by
1101 /// internal MachineInstr functions.
1103 return OperandRecycler.allocate(Cap, Allocator);
1104 }
1105
1106 /// Dellocate an array of MachineOperands and recycle the memory. This is
1107 /// only intended for use by internal MachineInstr functions.
1108 /// Cap must be the same capacity that was used to allocate the array.
1110 OperandRecycler.deallocate(Cap, Array);
1111 }
1112
1113 /// Allocate and initialize a register mask with @p NumRegister bits.
1114 uint32_t *allocateRegMask();
1115
1116 ArrayRef<int> allocateShuffleMask(ArrayRef<int> Mask);
1117
1118 /// Allocate and construct an extra info structure for a `MachineInstr`.
1119 ///
1120 /// This is allocated on the function's allocator and so lives the life of
1121 /// the function.
1122 MachineInstr::ExtraInfo *createMIExtraInfo(
1123 ArrayRef<MachineMemOperand *> MMOs, MCSymbol *PreInstrSymbol = nullptr,
1124 MCSymbol *PostInstrSymbol = nullptr, MDNode *HeapAllocMarker = nullptr,
1125 MDNode *PCSections = nullptr, uint32_t CFIType = 0);
1126
1127 /// Allocate a string and populate it with the given external symbol name.
1128 const char *createExternalSymbolName(StringRef Name);
1129
1130 //===--------------------------------------------------------------------===//
1131 // Label Manipulation.
1132
1133 /// getJTISymbol - Return the MCSymbol for the specified non-empty jump table.
1134 /// If isLinkerPrivate is specified, an 'l' label is returned, otherwise a
1135 /// normal 'L' label is returned.
1136 MCSymbol *getJTISymbol(unsigned JTI, MCContext &Ctx,
1137 bool isLinkerPrivate = false) const;
1138
1139 /// getPICBaseSymbol - Return a function-local symbol to represent the PIC
1140 /// base.
1141 MCSymbol *getPICBaseSymbol() const;
1142
1143 /// Returns a reference to a list of cfi instructions in the function's
1144 /// prologue. Used to construct frame maps for debug and exception handling
1145 /// comsumers.
1146 const std::vector<MCCFIInstruction> &getFrameInstructions() const {
1147 return FrameInstructions;
1148 }
1149
1150 [[nodiscard]] unsigned addFrameInst(const MCCFIInstruction &Inst);
1151
1152 /// Returns a reference to a list of symbols immediately following calls to
1153 /// _setjmp in the function. Used to construct the longjmp target table used
1154 /// by Windows Control Flow Guard.
1155 const std::vector<MCSymbol *> &getLongjmpTargets() const {
1156 return LongjmpTargets;
1157 }
1158
1159 /// Add the specified symbol to the list of valid longjmp targets for Windows
1160 /// Control Flow Guard.
1161 void addLongjmpTarget(MCSymbol *Target) { LongjmpTargets.push_back(Target); }
1162
1163 /// Returns a reference to a list of symbols that we have catchrets.
1164 /// Used to construct the catchret target table used by Windows EHCont Guard.
1165 const std::vector<MCSymbol *> &getCatchretTargets() const {
1166 return CatchretTargets;
1167 }
1168
1169 /// Add the specified symbol to the list of valid catchret targets for Windows
1170 /// EHCont Guard.
1172 CatchretTargets.push_back(Target);
1173 }
1174
1175 /// \name Exception Handling
1176 /// \{
1177
1178 bool callsEHReturn() const { return CallsEHReturn; }
1179 void setCallsEHReturn(bool b) { CallsEHReturn = b; }
1180
1181 bool callsUnwindInit() const { return CallsUnwindInit; }
1182 void setCallsUnwindInit(bool b) { CallsUnwindInit = b; }
1183
1184 bool hasEHCatchret() const { return HasEHCatchret; }
1185 void setHasEHCatchret(bool V) { HasEHCatchret = V; }
1186
1187 bool hasEHScopes() const { return HasEHScopes; }
1188 void setHasEHScopes(bool V) { HasEHScopes = V; }
1189
1190 bool hasEHFunclets() const { return HasEHFunclets; }
1191 void setHasEHFunclets(bool V) { HasEHFunclets = V; }
1192
1193 bool isOutlined() const { return IsOutlined; }
1194 void setIsOutlined(bool V) { IsOutlined = V; }
1195
1196 /// Find or create an LandingPadInfo for the specified MachineBasicBlock.
1197 LandingPadInfo &getOrCreateLandingPadInfo(MachineBasicBlock *LandingPad);
1198
1199 /// Return a reference to the landing pad info for the current function.
1200 const std::vector<LandingPadInfo> &getLandingPads() const {
1201 return LandingPads;
1202 }
1203
1204 /// Provide the begin and end labels of an invoke style call and associate it
1205 /// with a try landing pad block.
1206 void addInvoke(MachineBasicBlock *LandingPad,
1207 MCSymbol *BeginLabel, MCSymbol *EndLabel);
1208
1209 /// Add a new panding pad, and extract the exception handling information from
1210 /// the landingpad instruction. Returns the label ID for the landing pad
1211 /// entry.
1212 MCSymbol *addLandingPad(MachineBasicBlock *LandingPad);
1213
1214 /// Return the type id for the specified typeinfo. This is function wide.
1215 unsigned getTypeIDFor(const GlobalValue *TI);
1216
1217 /// Return the id of the filter encoded by TyIds. This is function wide.
1218 int getFilterIDFor(ArrayRef<unsigned> TyIds);
1219
1220 /// Map the landing pad's EH symbol to the call site indexes.
1221 void setCallSiteLandingPad(MCSymbol *Sym, ArrayRef<unsigned> Sites);
1222
1223 /// Return if there is any wasm exception handling.
1225 return !WasmLPadToIndexMap.empty();
1226 }
1227
1228 /// Map the landing pad to its index. Used for Wasm exception handling.
1229 void setWasmLandingPadIndex(const MachineBasicBlock *LPad, unsigned Index) {
1230 WasmLPadToIndexMap[LPad] = Index;
1231 }
1232
1233 /// Returns true if the landing pad has an associate index in wasm EH.
1235 return WasmLPadToIndexMap.count(LPad);
1236 }
1237
1238 /// Get the index in wasm EH for a given landing pad.
1239 unsigned getWasmLandingPadIndex(const MachineBasicBlock *LPad) const {
1240 assert(hasWasmLandingPadIndex(LPad));
1241 return WasmLPadToIndexMap.lookup(LPad);
1242 }
1243
1245 return !LPadToCallSiteMap.empty();
1246 }
1247
1248 /// Get the call site indexes for a landing pad EH symbol.
1250 assert(hasCallSiteLandingPad(Sym) &&
1251 "missing call site number for landing pad!");
1252 return LPadToCallSiteMap[Sym];
1253 }
1254
1255 /// Return true if the landing pad Eh symbol has an associated call site.
1257 return !LPadToCallSiteMap[Sym].empty();
1258 }
1259
1260 bool hasAnyCallSiteLabel() const {
1261 return !CallSiteMap.empty();
1262 }
1263
1264 /// Map the begin label for a call site.
1265 void setCallSiteBeginLabel(MCSymbol *BeginLabel, unsigned Site) {
1266 CallSiteMap[BeginLabel] = Site;
1267 }
1268
1269 /// Get the call site number for a begin label.
1270 unsigned getCallSiteBeginLabel(MCSymbol *BeginLabel) const {
1271 assert(hasCallSiteBeginLabel(BeginLabel) &&
1272 "Missing call site number for EH_LABEL!");
1273 return CallSiteMap.lookup(BeginLabel);
1274 }
1275
1276 /// Return true if the begin label has a call site number associated with it.
1277 bool hasCallSiteBeginLabel(MCSymbol *BeginLabel) const {
1278 return CallSiteMap.count(BeginLabel);
1279 }
1280
1281 /// Record annotations associated with a particular label.
1283 CodeViewAnnotations.push_back({Label, MD});
1284 }
1285
1287 return CodeViewAnnotations;
1288 }
1289
1290 /// Return a reference to the C++ typeinfo for the current function.
1291 const std::vector<const GlobalValue *> &getTypeInfos() const {
1292 return TypeInfos;
1293 }
1294
1295 /// Return a reference to the typeids encoding filters used in the current
1296 /// function.
1297 const std::vector<unsigned> &getFilterIds() const {
1298 return FilterIds;
1299 }
1300
1301 /// \}
1302
1303 /// Collect information used to emit debugging information of a variable in a
1304 /// stack slot.
1306 int Slot, const DILocation *Loc) {
1307 VariableDbgInfos.emplace_back(Var, Expr, Slot, Loc);
1308 }
1309
1310 /// Collect information used to emit debugging information of a variable in
1311 /// the entry value of a register.
1313 MCRegister Reg, const DILocation *Loc) {
1314 VariableDbgInfos.emplace_back(Var, Expr, Reg, Loc);
1315 }
1316
1317 VariableDbgInfoMapTy &getVariableDbgInfo() { return VariableDbgInfos; }
1319 return VariableDbgInfos;
1320 }
1321
1322 /// Returns the collection of variables for which we have debug info and that
1323 /// have been assigned a stack slot.
1325 return make_filter_range(getVariableDbgInfo(), [](auto &VarInfo) {
1326 return VarInfo.inStackSlot();
1327 });
1328 }
1329
1330 /// Returns the collection of variables for which we have debug info and that
1331 /// have been assigned a stack slot.
1333 return make_filter_range(getVariableDbgInfo(), [](const auto &VarInfo) {
1334 return VarInfo.inStackSlot();
1335 });
1336 }
1337
1338 /// Returns the collection of variables for which we have debug info and that
1339 /// have been assigned an entry value register.
1341 return make_filter_range(getVariableDbgInfo(), [](const auto &VarInfo) {
1342 return VarInfo.inEntryValueRegister();
1343 });
1344 }
1345
1346 /// Start tracking the arguments passed to the call \p CallI.
1350 bool Inserted =
1351 CallSitesInfo.try_emplace(CallI, std::move(CallInfo)).second;
1352 (void)Inserted;
1353 assert(Inserted && "Call site info not unique");
1354 }
1355
1357 return CallSitesInfo;
1358 }
1359
1360 /// Following functions update call site info. They should be called before
1361 /// removing, replacing or copying call instruction.
1362
1363 /// Erase the call site info for \p MI. It is used to remove a call
1364 /// instruction from the instruction stream.
1365 void eraseCallSiteInfo(const MachineInstr *MI);
1366 /// Copy the call site info from \p Old to \ New. Its usage is when we are
1367 /// making a copy of the instruction that will be inserted at different point
1368 /// of the instruction stream.
1369 void copyCallSiteInfo(const MachineInstr *Old,
1370 const MachineInstr *New);
1371
1372 /// Move the call site info from \p Old to \New call site info. This function
1373 /// is used when we are replacing one call instruction with another one to
1374 /// the same callee.
1375 void moveCallSiteInfo(const MachineInstr *Old,
1376 const MachineInstr *New);
1377
1379 return ++DebugInstrNumberingCount;
1380 }
1381};
1382
1383//===--------------------------------------------------------------------===//
1384// GraphTraits specializations for function basic block graphs (CFGs)
1385//===--------------------------------------------------------------------===//
1386
1387// Provide specializations of GraphTraits to be able to treat a
1388// machine function as a graph of machine basic blocks... these are
1389// the same as the machine basic block iterators, except that the root
1390// node is implicitly the first node of the function.
1391//
1392template <> struct GraphTraits<MachineFunction*> :
1394 static NodeRef getEntryNode(MachineFunction *F) { return &F->front(); }
1395
1396 // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
1398
1400 return nodes_iterator(F->begin());
1401 }
1402
1404 return nodes_iterator(F->end());
1405 }
1406
1407 static unsigned size (MachineFunction *F) { return F->size(); }
1408};
1409template <> struct GraphTraits<const MachineFunction*> :
1411 static NodeRef getEntryNode(const MachineFunction *F) { return &F->front(); }
1412
1413 // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
1415
1417 return nodes_iterator(F->begin());
1418 }
1419
1421 return nodes_iterator(F->end());
1422 }
1423
1424 static unsigned size (const MachineFunction *F) {
1425 return F->size();
1426 }
1427};
1428
1429// Provide specializations of GraphTraits to be able to treat a function as a
1430// graph of basic blocks... and to walk it in inverse order. Inverse order for
1431// a function is considered to be when traversing the predecessor edges of a BB
1432// instead of the successor edges.
1433//
1434template <> struct GraphTraits<Inverse<MachineFunction*>> :
1437 return &G.Graph->front();
1438 }
1439};
1443 return &G.Graph->front();
1444 }
1445};
1446
1447void verifyMachineFunction(const std::string &Banner,
1448 const MachineFunction &MF);
1449
1450} // end namespace llvm
1451
1452#endif // LLVM_CODEGEN_MACHINEFUNCTION_H
unsigned SubReg
aarch64 AArch64 CCMP Pass
aarch64 promote const
MachineBasicBlock & MBB
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.
This file implements the BitVector class.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static void viewCFG(Function &F, const BlockFrequencyInfo *BFI, const BranchProbabilityInfo *BPI, uint64_t MaxFreq, bool CFGOnly=false)
Definition: CFGPrinter.cpp:82
#define LLVM_EXTERNAL_VISIBILITY
Definition: Compiler.h:135
static void clear(coro::Shape &Shape)
Definition: Coroutines.cpp:148
static unsigned InstrCount
This file defines the DenseMap class.
std::string Name
uint32_t Index
uint64_t Size
std::optional< std::vector< StOtherPiece > > Other
Definition: ELFYAML.cpp:1290
uint64_t Offset
Definition: ELF_riscv.cpp:478
Symbol * Sym
Definition: ELF_riscv.cpp:479
This file defines the little GraphTraits<X> template class that should be specialized by classes that...
IRTranslator LLVM IR MI
#define F(x, y, z)
Definition: MD5.cpp:55
#define G(x, y, z)
Definition: MD5.cpp:56
unsigned Reg
static unsigned addLiveIn(MachineFunction &MF, unsigned PReg, const TargetRegisterClass *RC)
#define P(N)
ppc ctr loops verify
static StringRef getName(Value *V)
Basic Register Allocator
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
raw_pwrite_stream & OS
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.
Definition: ArrayRecycler.h:71
Recycle small arrays allocated from a BumpPtrAllocator.
Definition: ArrayRecycler.h:28
T * allocate(Capacity Cap, AllocatorType &Allocator)
Allocate an array of at least the requested capacity.
void deallocate(Capacity Cap, T *Ptr)
Deallocate an array with the specified Capacity.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
LLVM Basic Block Representation.
Definition: BasicBlock.h:60
BitVector & reset()
Definition: BitVector.h:392
BitVector & set()
Definition: BitVector.h:351
The address of a basic block.
Definition: Constants.h:888
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:66
DWARF expression.
Debug location.
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:110
A debug info location.
Definition: DebugLoc.h:33
ValueT lookup(const_arg_type_t< KeyT > Val) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
Definition: DenseMap.h:202
std::pair< iterator, bool > try_emplace(KeyT &&Key, Ts &&... Args)
Definition: DenseMap.h:235
bool empty() const
Definition: DenseMap.h:98
size_type count(const_arg_type_t< KeyT > Val) const
Return 1 if the specified key is in the map, 0 otherwise.
Definition: DenseMap.h:151
Abstract class that contains various methods for clients to notify about changes.
This class describes a target machine that is implemented with the LLVM target-independent code gener...
Context object for machine code objects.
Definition: MCContext.h:76
Describe properties that are true of each instruction in the target description file.
Definition: MCInstrDesc.h:198
Wrapper class representing physical registers. Should be passed by value.
Definition: MCRegister.h:33
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition: MCSection.h:39
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:40
Metadata node.
Definition: Metadata.h:1067
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 & reset()
Reset all the properties.
MachineFunctionProperties & set(const MachineFunctionProperties &MFP)
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)
Location of a PHI instruction that is also a debug-info variable value, for the duration of register ...
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.
Replacement definition for a debug instruction reference.
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.
Description of the location of a variable whose Address is valid and unchanging during function execu...
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.
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.
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)
std::pair< unsigned, unsigned > DebugInstrOperandPair
Pair of instruction number and operand number.
ArrayRecycler< MachineOperand >::Capacity OperandCapacity
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
PseudoSourceValueManager & getPSVManager() const
void setCallSiteBeginLabel(MCSymbol *BeginLabel, unsigned Site)
Map the begin label for a call site.
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.
void setHasEHCatchret(bool V)
MachineFunction & operator=(const MachineFunction &)=delete
bool hasInlineAsm() const
Returns true if the function contains any inline assembly.
void setCallsEHReturn(bool b)
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()
GISelChangeObserver * getObserver() const
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
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()
bool hasBBSections() const
Returns true if this function has basic block sections enabled.
MCContext & getContext() 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.
unsigned size() const
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...
reverse_iterator rend()
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 addCatchretTarget(MCSymbol *Target)
Add the specified symbol to the list of valid catchret targets for Windows EHCont Guard.
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)
void addCallArgsForwardingRegs(const MachineInstr *CallI, CallSiteInfoImpl &&CallInfo)
Start tracking the arguments passed to the call CallI.
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)
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
void erase(MachineBasicBlock *MBBI)
unsigned getNumBlockIDs() const
getNumBlockIDs - Return the number of MBB ID's allocated.
const_iterator begin() const
void remove(MachineBasicBlock *MBBI)
const std::vector< MCSymbol * > & getLongjmpTargets() const
Returns a reference to a list of symbols immediately following calls to _setjmp in the function.
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
MachineModuleInfo & getMMI() const
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)
static BasicBlockListType MachineFunction::* getSublistAccess(MachineBasicBlock *)
Support for MachineBasicBlock::getNextNode().
void sort(Comp comp)
bool hasWasmLandingPadIndex(const MachineBasicBlock *LPad) const
Returns true if the landing pad has an associate index in wasm EH.
const MachineFunctionProperties & getProperties() const
Get the function properties.
Ty * cloneInfo(const Ty &Old)
const std::vector< MCSymbol * > & getCatchretTargets() const
Returns a reference to a list of symbols that we have catchrets.
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
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)
bool hasBBLabels() const
Returns true if basic block labels are to be generated for this function.
const Ty * getInfo() const
const MachineJumpTableInfo * getJumpTableInfo() const
getJumpTableInfo - Return the jump table info object for the current function.
const_reverse_iterator rend() const
bool hasAnyCallSiteLandingPad() const
WasmEHFuncInfo * getWasmEHFuncInfo()
void splice(iterator InsertPt, iterator MBBI)
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()
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.
Definition: MachineInstr.h:69
bool isCandidateForCallSiteEntry(QueryType Type=IgnoreBundle) const
Return true if this is a call instruction that may have an associated call site entry in the debug in...
A description of a memory reference used in the backend.
Flags
Flags values. These may be or'd together.
This class contains meta information specific to a module.
MachineOperand class - Representation of each machine instruction operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Pass interface - Implemented by all 'passes'.
Definition: Pass.h:94
Manages creation of pseudo source values.
Recycler - This class manages a linked-list of deallocated nodes and facilitates reusing deallocated ...
Definition: Recycler.h:34
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
SlotIndexes pass.
Definition: SlotIndexes.h:300
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:586
reference emplace_back(ArgTypes &&... Args)
Definition: SmallVector.h:950
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: SmallVector.h:267
std::reverse_iterator< iterator > reverse_iterator
Definition: SmallVector.h:268
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1209
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
TargetSubtargetInfo - Generic base class for all target subtargets.
Target - Wrapper for Target specific information.
void splice(iterator where, iplist_impl &L2)
Definition: ilist.h:266
void push_back(pointer val)
Definition: ilist.h:250
iterator erase(iterator where)
Definition: ilist.h:204
pointer remove(iterator &IT)
Definition: ilist.h:188
void push_front(pointer val)
Definition: ilist.h:249
iterator insert(iterator where, pointer New)
Definition: ilist.h:165
An intrusive list with ownership and callbacks specified/controlled by ilist_traits,...
Definition: ilist.h:328
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
This file defines classes to implement an intrusive doubly linked list class (i.e.
@ BasicBlock
Various leaf nodes.
Definition: ISDOpcodes.h:71
@ BlockAddress
Definition: ISDOpcodes.h:84
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
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...
Definition: STLExtras.h:581
AtomicOrdering
Atomic ordering for LLVM's memory model.
BasicBlockSection
Definition: TargetOptions.h:61
#define N
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
Definition: Metadata.h:760
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
Represent subnormal handling kind for floating point instruction inputs and outputs.
static NodeRef getEntryNode(Inverse< MachineFunction * > G)
static NodeRef getEntryNode(Inverse< const MachineFunction * > G)
static unsigned size(MachineFunction *F)
static nodes_iterator nodes_begin(MachineFunction *F)
static nodes_iterator nodes_end(MachineFunction *F)
static NodeRef getEntryNode(MachineFunction *F)
static nodes_iterator nodes_begin(const MachineFunction *F)
static nodes_iterator nodes_end(const MachineFunction *F)
static unsigned size(const MachineFunction *F)
static NodeRef getEntryNode(const MachineFunction *F)
This structure is used to retain landing pad info for the current function.
SmallVector< MCSymbol *, 1 > EndLabels
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 * 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)
Structure used to represent pair of argument number after call lowering and register used to transfer...
ArgRegPair(Register R, unsigned Arg)
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.
Use delete by default for iplist and ilist.
Definition: ilist.h:41
static void deleteNode(NodeTy *V)
Definition: ilist.h:42
void transferNodesFromList(ilist_callback_traits &OldList, Iterator, Iterator)
Callbacks do nothing by default in iplist and ilist.
Definition: ilist.h:65
void removeNodeFromList(NodeTy *)
Definition: ilist.h:67
void addNodeToList(NodeTy *)
Definition: ilist.h:66
Template traits for intrusive list.
Definition: ilist.h:90