llvm.org GIT mirror llvm / 1d081e6
[CodeGen] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304265 91177308-0d34-0410-b5e6-96231b3b80d8 Eugene Zelenko 2 years ago
10 changed file(s) with 279 addition(s) and 220 deletion(s). Raw diff Collapse all Expand all
None //===-- CodeGen/MachineConstantPool.h - Abstract Constant Pool --*- C++ -*-===//
0 //===- CodeGen/MachineConstantPool.h - Abstract Constant Pool ---*- C++ -*-===//
11 //
22 // The LLVM Compiler Infrastructure
33 //
1717
1818 #include "llvm/ADT/DenseSet.h"
1919 #include "llvm/MC/SectionKind.h"
20 #include
2120 #include
2221 #include
2322
2423 namespace llvm {
2524
2625 class Constant;
26 class DataLayout;
2727 class FoldingSetNodeID;
28 class DataLayout;
29 class TargetMachine;
30 class Type;
3128 class MachineConstantPool;
3229 class raw_ostream;
30 class Type;
3331
3432 /// Abstract base class for all machine specific constantpool value subclasses.
3533 ///
3634 class MachineConstantPoolValue {
3735 virtual void anchor();
36
3837 Type *Ty;
3938
4039 public:
4140 explicit MachineConstantPoolValue(Type *ty) : Ty(ty) {}
42 virtual ~MachineConstantPoolValue() {}
41 virtual ~MachineConstantPoolValue() = default;
4342
4443 /// getType - get type of this MachineConstantPoolValue.
4544 ///
8079 : Alignment(A) {
8180 Val.ConstVal = V;
8281 }
82
8383 MachineConstantPoolEntry(MachineConstantPoolValue *V, unsigned A)
8484 : Alignment(A) {
8585 Val.MachineCPVal = V;
152152
153153 /// print - Used by the MachineFunction printer to print information about
154154 /// constant pool objects. Implemented in MachineFunction.cpp
155 ///
156155 void print(raw_ostream &OS) const;
157156
158157 /// dump - Call print(cerr) to be called from the debugger.
159158 void dump() const;
160159 };
161160
162 } // End llvm namespace
161 } // end namespace llvm
163162
164 #endif
163 #endif // LLVM_CODEGEN_MACHINECONSTANTPOOL_H
None //===-- llvm/CodeGen/MachineFunction.h --------------------------*- C++ -*-===//
0 //===- llvm/CodeGen/MachineFunction.h ---------------------------*- C++ -*-===//
11 //
22 // The LLVM Compiler Infrastructure
33 //
1717 #ifndef LLVM_CODEGEN_MACHINEFUNCTION_H
1818 #define LLVM_CODEGEN_MACHINEFUNCTION_H
1919
20 #include "llvm/ADT/ArrayRef.h"
2021 #include "llvm/ADT/BitVector.h"
22 #include "llvm/ADT/DenseMap.h"
23 #include "llvm/ADT/GraphTraits.h"
2124 #include "llvm/ADT/ilist.h"
25 #include "llvm/ADT/iterator.h"
2226 #include "llvm/ADT/Optional.h"
27 #include "llvm/ADT/SmallVector.h"
28 #include "llvm/ADT/StringRef.h"
2329 #include "llvm/Analysis/EHPersonalities.h"
2430 #include "llvm/CodeGen/MachineBasicBlock.h"
31 #include "llvm/CodeGen/MachineInstr.h"
2532 #include "llvm/CodeGen/MachineMemOperand.h"
2633 #include "llvm/IR/DebugLoc.h"
34 #include "llvm/IR/Instructions.h"
2735 #include "llvm/IR/Metadata.h"
2836 #include "llvm/MC/MCDwarf.h"
2937 #include "llvm/MC/MCSymbol.h"
3038 #include "llvm/Support/Allocator.h"
3139 #include "llvm/Support/ArrayRecycler.h"
40 #include "llvm/Support/AtomicOrdering.h"
3241 #include "llvm/Support/Compiler.h"
42 #include "llvm/Support/ErrorHandling.h"
3343 #include "llvm/Support/Recycler.h"
44 #include
45 #include
46 #include
47 #include
48 #include
3449
3550 namespace llvm {
3651
37 class Value;
52 class BasicBlock;
53 class BlockAddress;
54 class DataLayout;
55 class DIExpression;
56 class DILocalVariable;
57 class DILocation;
3858 class Function;
39 class GCModuleInfo;
40 class MachineRegisterInfo;
59 class GlobalValue;
60 class MachineConstantPool;
4161 class MachineFrameInfo;
42 class MachineConstantPool;
62 class MachineFunction;
4363 class MachineJumpTableInfo;
4464 class MachineModuleInfo;
65 class MachineRegisterInfo;
4566 class MCContext;
67 class MCInstrDesc;
4668 class Pass;
4769 class PseudoSourceValueManager;
70 class raw_ostream;
71 class SlotIndexes;
4872 class TargetMachine;
73 class TargetRegisterClass;
4974 class TargetSubtargetInfo;
50 class TargetRegisterClass;
51 struct MachinePointerInfo;
5275 struct WinEHFuncInfo;
5376
5477 template <> struct ilist_alloc_traits {
136159 bool hasProperty(Property P) const {
137160 return Properties[static_cast(P)];
138161 }
162
139163 MachineFunctionProperties &set(Property P) {
140164 Properties.set(static_cast(P));
141165 return *this;
142166 }
167
143168 MachineFunctionProperties &reset(Property P) {
144169 Properties.reset(static_cast(P));
145170 return *this;
146171 }
172
147173 /// Reset all the properties.
148174 MachineFunctionProperties &reset() {
149175 Properties.reset();
150176 return *this;
151177 }
178
152179 MachineFunctionProperties &set(const MachineFunctionProperties &MFP) {
153180 Properties |= MFP.Properties;
154181 return *this;
155182 }
183
156184 MachineFunctionProperties &reset(const MachineFunctionProperties &MFP) {
157185 Properties.reset(MFP.Properties);
158186 return *this;
159187 }
188
160189 // Returns true if all properties set in V (i.e. required by a pass) are set
161190 // in this.
162191 bool verifyRequiredProperties(const MachineFunctionProperties &V) const {
178207 /// Address of block to recover at. Null for a finally handler.
179208 const BlockAddress *RecoverBA;
180209 };
181
182210
183211 /// This structure is used to retain landing pad info for the current function.
184212 struct LandingPadInfo {
186214 SmallVector BeginLabels; // Labels prior to invoke.
187215 SmallVector EndLabels; // Labels after invoke.
188216 SmallVector SEHHandlers; // SEH handlers active at this lpad.
189 MCSymbol *LandingPadLabel; // Label at beginning of landing pad.
190 std::vector TypeIds; // List of type ids (filters negative).
217 MCSymbol *LandingPadLabel = nullptr; // Label at beginning of landing pad.
218 std::vector TypeIds; // List of type ids (filters negative).
191219
192220 explicit LandingPadInfo(MachineBasicBlock *MBB)
193 : LandingPadBlock(MBB), LandingPadLabel(nullptr) {}
221 : LandingPadBlock(MBB) {}
194222 };
195223
196224 class MachineFunction {
238266 Recycler BasicBlockRecycler;
239267
240268 // List of machine basic blocks in function
241 typedef ilist BasicBlockListType;
269 using BasicBlockListType = ilist;
242270 BasicBlockListType BasicBlocks;
243271
244272 /// FunctionNumber - This provides a unique ID for each function emitted in
280308 std::vector LandingPads;
281309
282310 /// Map a landing pad's EH symbol to the call site indexes.
283 DenseMap > LPadToCallSiteMap;
311 DenseMap> LPadToCallSiteMap;
284312
285313 /// Map of invoke call site index values to associated begin EH_LABEL.
286314 DenseMap CallSiteMap;
301329 EHPersonality PersonalityTypeCache = EHPersonality::Unknown;
302330
303331 /// \}
304
305 MachineFunction(const MachineFunction &) = delete;
306 void operator=(const MachineFunction&) = delete;
307332
308333 /// Clear all the members of this MachineFunction, but the ones used
309334 /// to initialize again the MachineFunction.
315340 /// In particular, the XXXInfo data structure.
316341 /// \pre Fn, Target, MMI, and FunctionNumber are properly set.
317342 void init();
343
318344 public:
319
320345 struct VariableDbgInfo {
321346 const DILocalVariable *Var;
322347 const DIExpression *Expr;
327352 unsigned Slot, const DILocation *Loc)
328353 : Var(Var), Expr(Expr), Slot(Slot), Loc(Loc) {}
329354 };
330 typedef SmallVector VariableDbgInfoMapTy;
355 using VariableDbgInfoMapTy = SmallVector;
331356 VariableDbgInfoMapTy VariableDbgInfos;
332357
333358 MachineFunction(const Function *Fn, const TargetMachine &TM,
334359 unsigned FunctionNum, MachineModuleInfo &MMI);
360 MachineFunction(const MachineFunction &) = delete;
361 MachineFunction &operator=(const MachineFunction &) = delete;
335362 ~MachineFunction();
336363
337364 /// Reset the instance as if it was just created.
349376 const DataLayout &getDataLayout() const;
350377
351378 /// getFunction - Return the LLVM function that this machine code represents
352 ///
353379 const Function *getFunction() const { return Fn; }
354380
355381 /// getName - Return the name of the corresponding LLVM function.
356 ///
357382 StringRef getName() const;
358383
359384 /// getFunctionNumber - Return a unique ID for the current function.
360 ///
361385 unsigned getFunctionNumber() const { return FunctionNumber; }
362386
363387 /// getTarget - Return the target machine this machine code is compiled with
364 ///
365388 const TargetMachine &getTarget() const { return Target; }
366389
367390 /// getSubtarget - Return the subtarget for which this machine code is being
377400 }
378401
379402 /// getRegInfo - Return information about the registers currently in use.
380 ///
381403 MachineRegisterInfo &getRegInfo() { return *RegInfo; }
382404 const MachineRegisterInfo &getRegInfo() const { return *RegInfo; }
383405
384406 /// getFrameInfo - Return the frame info object for the current function.
385407 /// This object contains information about objects allocated on the stack
386408 /// frame of the current function in an abstract way.
387 ///
388409 MachineFrameInfo &getFrameInfo() { return *FrameInfo; }
389410 const MachineFrameInfo &getFrameInfo() const { return *FrameInfo; }
390411
401422
402423 /// getConstantPool - Return the constant pool object for the current
403424 /// function.
404 ///
405425 MachineConstantPool *getConstantPool() { return ConstantPool; }
406426 const MachineConstantPool *getConstantPool() const { return ConstantPool; }
407427
412432 WinEHFuncInfo *getWinEHFuncInfo() { return WinEHInfo; }
413433
414434 /// getAlignment - Return the alignment (log2, not bytes) of the function.
415 ///
416435 unsigned getAlignment() const { return Alignment; }
417436
418437 /// setAlignment - Set the alignment (log2, not bytes) of the function.
419 ///
420438 void setAlignment(unsigned A) { Alignment = A; }
421439
422440 /// ensureAlignment - Make sure the function is at least 1 << A bytes aligned.
486504 bool shouldSplitStack() const;
487505
488506 /// getNumBlockIDs - Return the number of MBB ID's allocated.
489 ///
490507 unsigned getNumBlockIDs() const { return (unsigned)MBBNumbering.size(); }
491508
492509 /// RenumberBlocks - This discards all of the MachineBasicBlock numbers and
498515
499516 /// print - Print out the MachineFunction in a format suitable for debugging
500517 /// to the specified stream.
501 ///
502518 void print(raw_ostream &OS, const SlotIndexes* = nullptr) const;
503519
504520 /// viewCFG - This function is meant for use from the debugger. You can just
506522 /// program, displaying the CFG of the current function with the code for each
507523 /// basic block inside. This depends on there being a 'dot' and 'gv' program
508524 /// in your path.
509 ///
510525 void viewCFG() const;
511526
512527 /// viewCFGOnly - This function is meant for use from the debugger. It works
517532 void viewCFGOnly() const;
518533
519534 /// dump - Print the current MachineFunction to cerr, useful for debugger use.
520 ///
521535 void dump() const;
522536
523537 /// Run the current MachineFunction through the machine code verifier, useful
527541 bool AbortOnError = true) const;
528542
529543 // Provide accessors for the MachineBasicBlock list...
530 typedef BasicBlockListType::iterator iterator;
531 typedef BasicBlockListType::const_iterator const_iterator;
532 typedef BasicBlockListType::const_reverse_iterator const_reverse_iterator;
533 typedef BasicBlockListType::reverse_iterator reverse_iterator;
544 using iterator = BasicBlockListType::iterator;
545 using const_iterator = BasicBlockListType::const_iterator;
546 using const_reverse_iterator = BasicBlockListType::const_reverse_iterator;
547 using reverse_iterator = BasicBlockListType::reverse_iterator;
534548
535549 /// Support for MachineBasicBlock::getNextNode().
536550 static BasicBlockListType MachineFunction::*
589603
590604 //===--------------------------------------------------------------------===//
591605 // Internal functions used to automatically number MachineBasicBlocks
592 //
593606
594607 /// \brief Adds the MBB to the internal numbering. Returns the unique number
595608 /// assigned to the MBB.
596 ///
597609 unsigned addToMBBNumbering(MachineBasicBlock *MBB) {
598610 MBBNumbering.push_back(MBB);
599611 return (unsigned)MBBNumbering.size()-1;
609621
610622 /// CreateMachineInstr - Allocate a new MachineInstr. Use this instead
611623 /// of `new MachineInstr'.
612 ///
613624 MachineInstr *CreateMachineInstr(const MCInstrDesc &MCID, const DebugLoc &DL,
614625 bool NoImp = false);
615626
622633 MachineInstr *CloneMachineInstr(const MachineInstr *Orig);
623634
624635 /// DeleteMachineInstr - Delete the given MachineInstr.
625 ///
626636 void DeleteMachineInstr(MachineInstr *MI);
627637
628638 /// CreateMachineBasicBlock - Allocate a new MachineBasicBlock. Use this
629639 /// instead of `new MachineBasicBlock'.
630 ///
631640 MachineBasicBlock *CreateMachineBasicBlock(const BasicBlock *bb = nullptr);
632641
633642 /// DeleteMachineBasicBlock - Delete the given MachineBasicBlock.
634 ///
635643 void DeleteMachineBasicBlock(MachineBasicBlock *MBB);
636644
637645 /// getMachineMemOperand - Allocate a new MachineMemOperand.
652660 MachineMemOperand *getMachineMemOperand(const MachineMemOperand *MMO,
653661 int64_t Offset, uint64_t Size);
654662
655 typedef ArrayRecycler::Capacity OperandCapacity;
663 using OperandCapacity = ArrayRecycler::Capacity;
656664
657665 /// Allocate an array of MachineOperands. This is only intended for use by
658666 /// internal MachineInstr functions.
699707
700708 //===--------------------------------------------------------------------===//
701709 // Label Manipulation.
702 //
703710
704711 /// getJTISymbol - Return the MCSymbol for the specified non-empty jump table.
705712 /// If isLinkerPrivate is specified, an 'l' label is returned, otherwise a
857864 static NodeRef getEntryNode(MachineFunction *F) { return &F->front(); }
858865
859866 // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
860 typedef pointer_iterator nodes_iterator;
867 using nodes_iterator = pointer_iterator;
868
861869 static nodes_iterator nodes_begin(MachineFunction *F) {
862870 return nodes_iterator(F->begin());
863871 }
872
864873 static nodes_iterator nodes_end(MachineFunction *F) {
865874 return nodes_iterator(F->end());
866875 }
876
867877 static unsigned size (MachineFunction *F) { return F->size(); }
868878 };
869879 template <> struct GraphTraits :
871881 static NodeRef getEntryNode(const MachineFunction *F) { return &F->front(); }
872882
873883 // nodes_iterator/begin/end - Allow iteration over all nodes in the graph
874 typedef pointer_iterator nodes_iterator;
884 using nodes_iterator = pointer_iterator;
885
875886 static nodes_iterator nodes_begin(const MachineFunction *F) {
876887 return nodes_iterator(F->begin());
877888 }
889
878890 static nodes_iterator nodes_end (const MachineFunction *F) {
879891 return nodes_iterator(F->end());
880892 }
893
881894 static unsigned size (const MachineFunction *F) {
882895 return F->size();
883896 }
884897 };
885
886898
887899 // Provide specializations of GraphTraits to be able to treat a function as a
888900 // graph of basic blocks... and to walk it in inverse order. Inverse order for
889901 // a function is considered to be when traversing the predecessor edges of a BB
890902 // instead of the successor edges.
891903 //
892 template <> struct GraphTraits > :
893 public GraphTraits > {
904 template <> struct GraphTraits> :
905 public GraphTraits> {
894906 static NodeRef getEntryNode(Inverse G) {
895907 return &G.Graph->front();
896908 }
897909 };
898 template <> struct GraphTraits > :
899 public GraphTraits > {
910 template <> struct GraphTraits> :
911 public GraphTraits> {
900912 static NodeRef getEntryNode(Inverse G) {
901913 return &G.Graph->front();
902914 }
903915 };
904916
905 } // End llvm namespace
906
907 #endif
917 } // end namespace llvm
918
919 #endif // LLVM_CODEGEN_MACHINEFUNCTION_H
None //===- MachineFunctionInitializer.h - machine function initializer ---------===//
0 //=- MachineFunctionInitializer.h - machine function initializer --*- C++ -*-=//
11 //
22 // The LLVM Compiler Infrastructure
33 //
2424 virtual void anchor();
2525
2626 public:
27 virtual ~MachineFunctionInitializer() {}
27 virtual ~MachineFunctionInitializer() = default;
2828
2929 /// Initialize the machine function.
3030 ///
3434
3535 } // end namespace llvm
3636
37 #endif
37 #endif // LLVM_CODEGEN_MACHINEFUNCTIONINITIALIZER_H
None //===-- llvm/CodeGen/MachineInstr.h - MachineInstr class --------*- C++ -*-===//
0 //===- llvm/CodeGen/MachineInstr.h - MachineInstr class ---------*- C++ -*-===//
11 //
22 // The LLVM Compiler Infrastructure
33 //
1616 #define LLVM_CODEGEN_MACHINEINSTR_H
1717
1818 #include "llvm/ADT/DenseMapInfo.h"
19 #include "llvm/ADT/STLExtras.h"
2019 #include "llvm/ADT/ilist.h"
2120 #include "llvm/ADT/ilist_node.h"
2221 #include "llvm/ADT/iterator_range.h"
2726 #include "llvm/MC/MCInstrDesc.h"
2827 #include "llvm/Support/ArrayRecycler.h"
2928 #include "llvm/Target/TargetOpcodes.h"
29 #include
30 #include
31 #include
32 #include
3033
3134 namespace llvm {
3235
36 template class ArrayRef;
37 class DIExpression;
38 class DILocalVariable;
39 class MachineBasicBlock;
40 class MachineFunction;
41 class MachineMemOperand;
42 class MachineRegisterInfo;
43 class ModuleSlotTracker;
44 class raw_ostream;
45 template class SmallVectorImpl;
3346 class StringRef;
34 template class ArrayRef;
35 template class SmallVectorImpl;
36 class DILocalVariable;
37 class DIExpression;
3847 class TargetInstrInfo;
3948 class TargetRegisterClass;
4049 class TargetRegisterInfo;
41 class MachineFunction;
42 class MachineMemOperand;
4350
4451 //===----------------------------------------------------------------------===//
4552 /// Representation of each machine instruction.
5259 : public ilist_node_with_parent
5360 ilist_sentinel_tracking> {
5461 public:
55 typedef MachineMemOperand **mmo_iterator;
62 using mmo_iterator = MachineMemOperand **;
5663
5764 /// Flags to specify different kinds of comments to output in
5865 /// assembly code. These flags carry semantic information not
7178 BundledPred = 1 << 2, // Instruction has bundled predecessors.
7279 BundledSucc = 1 << 3 // Instruction has bundled successors.
7380 };
81
7482 private:
7583 const MCInstrDesc *MCID; // Instruction descriptor.
76 MachineBasicBlock *Parent; // Pointer to the owning basic block.
84 MachineBasicBlock *Parent = nullptr; // Pointer to the owning basic block.
7785
7886 // Operands are allocated by an ArrayRecycler.
79 MachineOperand *Operands; // Pointer to the first operand.
80 unsigned NumOperands; // Number of operands on instruction.
81 typedef ArrayRecycler::Capacity OperandCapacity;
87 MachineOperand *Operands = nullptr; // Pointer to the first operand.
88 unsigned NumOperands = 0; // Number of operands on instruction.
89 using OperandCapacity = ArrayRecycler::Capacity;
8290 OperandCapacity CapOperands; // Capacity of the Operands array.
8391
84 uint8_t Flags; // Various bits of additional
92 uint8_t Flags = 0; // Various bits of additional
8593 // information about machine
8694 // instruction.
8795
88 uint8_t AsmPrinterFlags; // Various bits of information used by
96 uint8_t AsmPrinterFlags = 0; // Various bits of information used by
8997 // the AsmPrinter to emit helpful
9098 // comments. This is *not* semantic
9199 // information. Do not use this for
92100 // anything other than to convey comment
93101 // information to AsmPrinter.
94102
95 uint8_t NumMemRefs; // Information on memory references.
103 uint8_t NumMemRefs = 0; // Information on memory references.
96104 // Note that MemRefs == nullptr, means 'don't know', not 'no memory access'.
97105 // Calling code must treat missing information conservatively. If the number
98106 // of memory operands required to be precise exceeds the maximum value of
99107 // NumMemRefs - currently 256 - we remove the operands entirely. Note also
100108 // that this is a non-owning reference to a shared copy on write buffer owned
101109 // by the MachineFunction and created via MF.allocateMemRefsArray.
102 mmo_iterator MemRefs;
110 mmo_iterator MemRefs = nullptr;
103111
104112 DebugLoc debugLoc; // Source line information.
105
106 MachineInstr(const MachineInstr&) = delete;
107 void operator=(const MachineInstr&) = delete;
108 // Use MachineFunction::DeleteMachineInstr() instead.
109 ~MachineInstr() = delete;
110113
111114 // Intrusive list support
112115 friend struct ilist_traits;
127130 friend class MachineFunction;
128131
129132 public:
133 MachineInstr(const MachineInstr &) = delete;
134 MachineInstr &operator=(const MachineInstr &) = delete;
135 // Use MachineFunction::DeleteMachineInstr() instead.
136 ~MachineInstr() = delete;
137
130138 const MachineBasicBlock* getParent() const { return Parent; }
131139 MachineBasicBlock* getParent() { return Parent; }
132140
176184 void clearFlag(MIFlag Flag) {
177185 Flags &= ~((uint8_t)Flag);
178186 }
179
180187
181188 /// Return true if MI is in a bundle (but not the first MI in a bundle).
182189 ///
262269 /// earlier.
263270 ///
264271 /// If this method returns, the caller should try to recover from the error.
265 ///
266272 void emitError(StringRef Msg) const;
267273
268274 /// Returns the target instruction descriptor of this MachineInstr.
272278 unsigned getOpcode() const { return MCID->Opcode; }
273279
274280 /// Access to explicit operands of the instruction.
275 ///
276281 unsigned getNumOperands() const { return NumOperands; }
277282
278283 const MachineOperand& getOperand(unsigned i) const {
288293 unsigned getNumExplicitOperands() const;
289294
290295 /// iterator/begin/end - Iterate over all operands of a machine instruction.
291 typedef MachineOperand *mop_iterator;
292 typedef const MachineOperand *const_mop_iterator;
296 using mop_iterator = MachineOperand *;
297 using const_mop_iterator = const MachineOperand *;
293298
294299 mop_iterator operands_begin() { return Operands; }
295300 mop_iterator operands_end() { return Operands + NumOperands; }
712717 return hasProperty(MCID::ExtraDefRegAllocReq, Type);
713718 }
714719
715
716720 enum MICheckType {
717721 CheckDefs, // Check all operands for equality
718722 CheckKillDead, // Check all operands including kill / dead markers
766770
767771 /// Returns true if the MachineInstr represents a label.
768772 bool isLabel() const { return isEHLabel() || isGCLabel(); }
773
769774 bool isCFIInstruction() const {
770775 return getOpcode() == TargetOpcode::CFI_INSTRUCTION;
771776 }
774779 bool isPosition() const { return isLabel() || isCFIInstruction(); }
775780
776781 bool isDebugValue() const { return getOpcode() == TargetOpcode::DBG_VALUE; }
782
777783 /// A DBG_VALUE is indirect iff the first operand is a register and
778784 /// the second operand is an immediate.
779785 bool isIndirectDebugValue() const {
786792 bool isKill() const { return getOpcode() == TargetOpcode::KILL; }
787793 bool isImplicitDef() const { return getOpcode()==TargetOpcode::IMPLICIT_DEF; }
788794 bool isInlineAsm() const { return getOpcode() == TargetOpcode::INLINEASM; }
795
789796 bool isMSInlineAsm() const {
790797 return getOpcode() == TargetOpcode::INLINEASM && getInlineAsmDialect();
791798 }
799
792800 bool isStackAligningInlineAsm() const;
793801 InlineAsm::AsmDialect getInlineAsmDialect() const;
802
794803 bool isInsertSubreg() const {
795804 return getOpcode() == TargetOpcode::INSERT_SUBREG;
796805 }
806
797807 bool isSubregToReg() const {
798808 return getOpcode() == TargetOpcode::SUBREG_TO_REG;
799809 }
810
800811 bool isRegSequence() const {
801812 return getOpcode() == TargetOpcode::REG_SEQUENCE;
802813 }
814
803815 bool isBundle() const {
804816 return getOpcode() == TargetOpcode::BUNDLE;
805817 }
818
806819 bool isCopy() const {
807820 return getOpcode() == TargetOpcode::COPY;
808821 }
822
809823 bool isFullCopy() const {
810824 return isCopy() && !getOperand(0).getSubReg() && !getOperand(1).getSubReg();
811825 }
826
812827 bool isExtractSubreg() const {
813828 return getOpcode() == TargetOpcode::EXTRACT_SUBREG;
814829 }
977992 ///
978993 /// The flag operand is an immediate that can be decoded with methods like
979994 /// InlineAsm::hasRegClassConstraint().
980 ///
981995 int findInlineAsmFlagIdx(unsigned OpIdx, unsigned *GroupNo = nullptr) const;
982996
983997 /// Compute the static register class constraint for operand OpIdx.
9861000 ///
9871001 /// Returns NULL if the static register class constraint cannot be
9881002 /// determined.
989 ///
9901003 const TargetRegisterClass*
9911004 getRegClassConstraint(unsigned OpIdx,
9921005 const TargetInstrInfo *TII,
13271340 return OS;
13281341 }
13291342
1330 } // End llvm namespace
1331
1332 #endif
1343 } // end namespace llvm
1344
1345 #endif // LLVM_CODEGEN_MACHINEINSTR_H
1414 #define LLVM_CODEGEN_MACHINEINSTRBUNDLEITERATOR_H
1515
1616 #include "llvm/ADT/ilist.h"
17 #include "llvm/ADT/simple_ilist.h"
18 #include
1719 #include
20 #include
1821
1922 namespace llvm {
2023
2124 template struct MachineInstrBundleIteratorTraits;
2225 template struct MachineInstrBundleIteratorTraits {
23 typedef simple_ilist> list_type;
24 typedef typename list_type::iterator instr_iterator;
25 typedef typename list_type::iterator nonconst_instr_iterator;
26 typedef typename list_type::const_iterator const_instr_iterator;
26 using list_type = simple_ilist>;
27 using instr_iterator = typename list_type::iterator;
28 using nonconst_instr_iterator = typename list_type::iterator;
29 using const_instr_iterator = typename list_type::const_iterator;
2730 };
2831 template struct MachineInstrBundleIteratorTraits {
29 typedef simple_ilist> list_type;
30 typedef typename list_type::reverse_iterator instr_iterator;
31 typedef typename list_type::reverse_iterator nonconst_instr_iterator;
32 typedef typename list_type::const_reverse_iterator const_instr_iterator;
32 using list_type = simple_ilist>;
33 using instr_iterator = typename list_type::reverse_iterator;
34 using nonconst_instr_iterator = typename list_type::reverse_iterator;
35 using const_instr_iterator = typename list_type::const_reverse_iterator;
3336 };
3437 template struct MachineInstrBundleIteratorTraits {
35 typedef simple_ilist> list_type;
36 typedef typename list_type::const_iterator instr_iterator;
37 typedef typename list_type::iterator nonconst_instr_iterator;
38 typedef typename list_type::const_iterator const_instr_iterator;
38 using list_type = simple_ilist>;
39 using instr_iterator = typename list_type::const_iterator;
40 using nonconst_instr_iterator = typename list_type::iterator;
41 using const_instr_iterator = typename list_type::const_iterator;
3942 };
4043 template struct MachineInstrBundleIteratorTraits {
41 typedef simple_ilist> list_type;
42 typedef typename list_type::const_reverse_iterator instr_iterator;
43 typedef typename list_type::reverse_iterator nonconst_instr_iterator;
44 typedef typename list_type::const_reverse_iterator const_instr_iterator;
44 using list_type = simple_ilist>;
45 using instr_iterator = typename list_type::const_reverse_iterator;
46 using nonconst_instr_iterator = typename list_type::reverse_iterator;
47 using const_instr_iterator = typename list_type::const_reverse_iterator;
4548 };
4649
4750 template struct MachineInstrBundleIteratorHelper;
103106 /// inside bundles (i.e. walk top level MIs only).
104107 template
105108 class MachineInstrBundleIterator : MachineInstrBundleIteratorHelper {
106 typedef MachineInstrBundleIteratorTraits Traits;
107 typedef typename Traits::instr_iterator instr_iterator;
109 using Traits = MachineInstrBundleIteratorTraits;
110 using instr_iterator = typename Traits::instr_iterator;
111
108112 instr_iterator MII;
109113
110114 public:
111 typedef typename instr_iterator::value_type value_type;
112 typedef typename instr_iterator::difference_type difference_type;
113 typedef typename instr_iterator::pointer pointer;
114 typedef typename instr_iterator::reference reference;
115 typedef std::bidirectional_iterator_tag iterator_category;
116
117 typedef typename instr_iterator::const_pointer const_pointer;
118 typedef typename instr_iterator::const_reference const_reference;
115 using value_type = typename instr_iterator::value_type;
116 using difference_type = typename instr_iterator::difference_type;
117 using pointer = typename instr_iterator::pointer;
118 using reference = typename instr_iterator::reference;
119 using const_pointer = typename instr_iterator::const_pointer;
120 using const_reference = typename instr_iterator::const_reference;
121 using iterator_category = std::bidirectional_iterator_tag;
119122
120123 private:
121 typedef typename Traits::nonconst_instr_iterator nonconst_instr_iterator;
122 typedef typename Traits::const_instr_iterator const_instr_iterator;
123 typedef MachineInstrBundleIterator<
124 typename nonconst_instr_iterator::value_type, IsReverse>
125 nonconst_iterator;
126 typedef MachineInstrBundleIterator reverse_iterator;
124 using nonconst_instr_iterator = typename Traits::nonconst_instr_iterator;
125 using const_instr_iterator = typename Traits::const_instr_iterator;
126 using nonconst_iterator =
127 MachineInstrBundleIterator
128 IsReverse>;
129 using reverse_iterator = MachineInstrBundleIterator;
127130
128131 public:
129132 MachineInstrBundleIterator(instr_iterator MI) : MII(MI) {
137140 "MachineInstrBundleIterator with a "
138141 "bundled MI");
139142 }
143
140144 MachineInstrBundleIterator(pointer MI) : MII(MI) {
141145 // FIXME: This conversion should be explicit.
142146 assert((!MI || !MI->isBundledWithPred()) && "It's not legal to initialize "
143147 "MachineInstrBundleIterator "
144148 "with a bundled MI");
145149 }
150
146151 // Template allows conversion from const to nonconst.
147152 template
148153 MachineInstrBundleIterator(
150155 typename std::enable_if::value,
151156 void *>::type = nullptr)
152157 : MII(I.getInstrIterator()) {}
158
153159 MachineInstrBundleIterator() : MII(nullptr) {}
154160
155161 /// Explicit conversion between forward/reverse iterators.
279285
280286 } // end namespace llvm
281287
282 #endif
288 #endif // LLVM_CODEGEN_MACHINEINSTRBUNDLEITERATOR_H
3232 #include "llvm/Analysis/LoopInfo.h"
3333 #include "llvm/CodeGen/MachineBasicBlock.h"
3434 #include "llvm/CodeGen/MachineFunctionPass.h"
35 #include "llvm/IR/DebugLoc.h"
36 #include "llvm/Pass.h"
3537
3638 namespace llvm {
3739
7072
7173 private:
7274 friend class LoopInfoBase;
75
7376 explicit MachineLoop(MachineBasicBlock *MBB)
7477 : LoopBase(MBB) {}
7578 };
7881 extern template class LoopInfoBase;
7982
8083 class MachineLoopInfo : public MachineFunctionPass {
81 LoopInfoBase LI;
8284 friend class LoopBase;
8385
84 void operator=(const MachineLoopInfo &) = delete;
85 MachineLoopInfo(const MachineLoopInfo &) = delete;
86 LoopInfoBase LI;
8687
8788 public:
8889 static char ID; // Pass identification, replacement for typeid
9091 MachineLoopInfo() : MachineFunctionPass(ID) {
9192 initializeMachineLoopInfoPass(*PassRegistry::getPassRegistry());
9293 }
94 MachineLoopInfo(const MachineLoopInfo &) = delete;
95 MachineLoopInfo &operator=(const MachineLoopInfo &) = delete;
9396
9497 LoopInfoBase& getBase() { return LI; }
9598
102105 bool SpeculativePreheader = false) const;
103106
104107 /// The iterator interface to the top-level loops in the current function.
105 typedef LoopInfoBase::iterator iterator;
108 using iterator = LoopInfoBase::iterator;
106109 inline iterator begin() const { return LI.begin(); }
107110 inline iterator end() const { return LI.end(); }
108111 bool empty() const { return LI.empty(); }
165168 }
166169 };
167170
168
169171 // Allow clients to walk the list of nested loops...
170172 template <> struct GraphTraits {
171 typedef const MachineLoop *NodeRef;
172 typedef MachineLoopInfo::iterator ChildIteratorType;
173 using NodeRef = const MachineLoop *;
174 using ChildIteratorType = MachineLoopInfo::iterator;
173175
174176 static NodeRef getEntryNode(const MachineLoop *L) { return L; }
175177 static ChildIteratorType child_begin(NodeRef N) { return N->begin(); }
177179 };
178180
179181 template <> struct GraphTraits {
180 typedef MachineLoop *NodeRef;
181 typedef MachineLoopInfo::iterator ChildIteratorType;
182 using NodeRef = MachineLoop *;
183 using ChildIteratorType = MachineLoopInfo::iterator;
182184
183185 static NodeRef getEntryNode(MachineLoop *L) { return L; }
184186 static ChildIteratorType child_begin(NodeRef N) { return N->begin(); }
185187 static ChildIteratorType child_end(NodeRef N) { return N->end(); }
186188 };
187189
188 } // End llvm namespace
190 } // end namespace llvm
189191
190 #endif
192 #endif // LLVM_CODEGEN_MACHINELOOPINFO_H
3030 #ifndef LLVM_CODEGEN_MACHINEMODULEINFO_H
3131 #define LLVM_CODEGEN_MACHINEMODULEINFO_H
3232
33 #include "llvm/ADT/ArrayRef.h"
3334 #include "llvm/ADT/DenseMap.h"
3435 #include "llvm/ADT/PointerIntPair.h"
35 #include "llvm/ADT/SmallPtrSet.h"
36 #include "llvm/ADT/SmallVector.h"
37 #include "llvm/IR/DebugLoc.h"
38 #include "llvm/IR/ValueHandle.h"
3936 #include "llvm/MC/MCContext.h"
4037 #include "llvm/MC/MCSymbol.h"
41 #include "llvm/MC/MachineLocation.h"
4238 #include "llvm/Pass.h"
43 #include "llvm/Support/DataTypes.h"
39 #include
40 #include
41 #include
4442
4543 namespace llvm {
4644
47 //===----------------------------------------------------------------------===//
48 // Forward declarations.
49 class BlockAddress;
45 class BasicBlock;
5046 class CallInst;
51 class Constant;
52 class GlobalVariable;
53 class LandingPadInst;
54 class MDNode;
55 class MMIAddrLabelMap;
56 class MachineBasicBlock;
47 class Function;
5748 class MachineFunction;
5849 class MachineFunctionInitializer;
50 class MMIAddrLabelMap;
5951 class Module;
60 class PointerType;
61 class StructType;
52 class TargetMachine;
6253
6354 //===----------------------------------------------------------------------===//
6455 /// This class can be derived from and used by targets to hold private
6859 ///
6960 class MachineModuleInfoImpl {
7061 public:
71 typedef PointerIntPair StubValueTy;
62 using StubValueTy = PointerIntPair;
63 using SymbolListTy = std::vector>;
64
7265 virtual ~MachineModuleInfoImpl();
73 typedef std::vector > SymbolListTy;
66
7467 protected:
75
7668 /// Return the entries from a DenseMap in a deterministic sorted orer.
7769 /// Clears the map.
7870 static SymbolListTy getSortedStubs(DenseMap&);
251243 /// which will link in MSVCRT's floating-point support.
252244 void computeUsesVAFloatArgument(const CallInst &I, MachineModuleInfo &MMI);
253245
254 } // End llvm namespace
255
256 #endif
246 } // end namespace llvm
247
248 #endif // LLVM_CODEGEN_MACHINEMODULEINFO_H
None //===-- lib/CodeGen/MachineInstr.cpp --------------------------------------===//
0 //===- lib/CodeGen/MachineInstr.cpp ---------------------------------------===//
11 //
22 // The LLVM Compiler Infrastructure
33 //
1010 //
1111 //===----------------------------------------------------------------------===//
1212
13 #include "llvm/CodeGen/MachineInstr.h"
13 #include "llvm/ADT/APFloat.h"
14 #include "llvm/ADT/ArrayRef.h"
1415 #include "llvm/ADT/FoldingSet.h"
1516 #include "llvm/ADT/Hashing.h"
17 #include "llvm/ADT/None.h"
18 #include "llvm/ADT/SmallString.h"
19 #include "llvm/ADT/SmallVector.h"
20 #include "llvm/ADT/STLExtras.h"
1621 #include "llvm/Analysis/AliasAnalysis.h"
17 #include "llvm/CodeGen/MachineConstantPool.h"
22 #include "llvm/Analysis/MemoryLocation.h"
23 #include "llvm/CodeGen/GlobalISel/RegisterBank.h"
24 #include "llvm/CodeGen/MachineBasicBlock.h"
1825 #include "llvm/CodeGen/MachineFunction.h"
26 #include "llvm/CodeGen/MachineInstr.h"
1927 #include "llvm/CodeGen/MachineInstrBuilder.h"
28 #include "llvm/CodeGen/MachineInstrBundle.h"
2029 #include "llvm/CodeGen/MachineMemOperand.h"
2130 #include "llvm/CodeGen/MachineModuleInfo.h"
31 #include "llvm/CodeGen/MachineOperand.h"
2232 #include "llvm/CodeGen/MachineRegisterInfo.h"
2333 #include "llvm/CodeGen/PseudoSourceValue.h"
2434 #include "llvm/IR/Constants.h"
25 #include "llvm/IR/DebugInfo.h"
35 #include "llvm/IR/DebugInfoMetadata.h"
36 #include "llvm/IR/DebugLoc.h"
37 #include "llvm/IR/DerivedTypes.h"
2638 #include "llvm/IR/Function.h"
2739 #include "llvm/IR/InlineAsm.h"
40 #include "llvm/IR/InstrTypes.h"
2841 #include "llvm/IR/Intrinsics.h"
2942 #include "llvm/IR/LLVMContext.h"
3043 #include "llvm/IR/Metadata.h"
3447 #include "llvm/IR/Value.h"
3548 #include "llvm/MC/MCInstrDesc.h"
3649 #include "llvm/MC/MCSymbol.h"
50 #include "llvm/MC/MCRegisterInfo.h"
51 #include "llvm/Support/Casting.h"
3752 #include "llvm/Support/CommandLine.h"
53 #include "llvm/Support/Compiler.h"
3854 #include "llvm/Support/Debug.h"
3955 #include "llvm/Support/ErrorHandling.h"
56 #include "llvm/Support/LowLevelTypeImpl.h"
4057 #include "llvm/Support/MathExtras.h"
4158 #include "llvm/Support/raw_ostream.h"
4259 #include "llvm/Target/TargetInstrInfo.h"
4461 #include "llvm/Target/TargetMachine.h"
4562 #include "llvm/Target/TargetRegisterInfo.h"
4663 #include "llvm/Target/TargetSubtargetInfo.h"
64 #include
65 #include
66 #include
67 #include
68 #include
69 #include
70 #include
71
4772 using namespace llvm;
4873
4974 static cl::opt PrintWholeRegMask(
255280 case MachineOperand::MO_GlobalAddress:
256281 return getGlobal() == Other.getGlobal() && getOffset() == Other.getOffset();
257282 case MachineOperand::MO_ExternalSymbol:
258 return !strcmp(getSymbolName(), Other.getSymbolName()) &&
283 return strcmp(getSymbolName(), Other.getSymbolName()) == 0 &&
259284 getOffset() == Other.getOffset();
260285 case MachineOperand::MO_BlockAddress:
261286 return getBlockAddress() == Other.getBlockAddress() &&
722747 /// the MCInstrDesc.
723748 MachineInstr::MachineInstr(MachineFunction &MF, const MCInstrDesc &tid,
724749 DebugLoc dl, bool NoImp)
725 : MCID(&tid), Parent(nullptr), Operands(nullptr), NumOperands(0), Flags(0),
726 AsmPrinterFlags(0), NumMemRefs(0), MemRefs(nullptr),
727 debugLoc(std::move(dl)) {
750 : MCID(&tid), debugLoc(std::move(dl)) {
728751 assert(debugLoc.hasTrivialDestructor() && "Expected trivial destructor");
729752
730753 // Reserve space for the expected number of operands.
741764 /// MachineInstr ctor - Copies MachineInstr arg exactly
742765 ///
743766 MachineInstr::MachineInstr(MachineFunction &MF, const MachineInstr &MI)
744 : MCID(&MI.getDesc()), Parent(nullptr), Operands(nullptr), NumOperands(0),
745 Flags(0), AsmPrinterFlags(0), NumMemRefs(MI.NumMemRefs),
746 MemRefs(MI.MemRefs), debugLoc(MI.getDebugLoc()) {
767 : MCID(&MI.getDesc()), NumMemRefs(MI.NumMemRefs), MemRefs(MI.MemRefs),
768 debugLoc(MI.getDebugLoc()) {
747769 assert(debugLoc.hasTrivialDestructor() && "Expected trivial destructor");
748770
749771 CapOperands = OperandCapacity::get(MI.getNumOperands());
16321654 // memory objects. It can save compile time, and possibly catch some
16331655 // corner cases not currently covered.
16341656
1635 assert ((MMOa->getOffset() >= 0) && "Negative MachineMemOperand offset");
1636 assert ((MMOb->getOffset() >= 0) && "Negative MachineMemOperand offset");
1657 assert((MMOa->getOffset() >= 0) && "Negative MachineMemOperand offset");
1658 assert((MMOb->getOffset() >= 0) && "Negative MachineMemOperand offset");
16371659
16381660 int64_t MinOffset = std::min(MMOa->getOffset(), MMOb->getOffset());
16391661 int64_t Overlapa = MMOa->getSize() + MMOa->getOffset() - MinOffset;
16661688 return true;
16671689
16681690 // Check if any of our memory operands are ordered.
1669 return any_of(memoperands(), [](const MachineMemOperand *MMO) {
1691 return llvm::any_of(memoperands(), [](const MachineMemOperand *MMO) {
16701692 return !MMO->isUnordered();
16711693 });
16721694 }
22222244 unsigned Reg = MO.getReg();
22232245 if (!TargetRegisterInfo::isPhysicalRegister(Reg)) continue;
22242246 // If there are no uses, including partial uses, the def is dead.
2225 if (none_of(UsedRegs,
2226 [&](unsigned Use) { return TRI.regsOverlap(Use, Reg); }))
2247 if (llvm::none_of(UsedRegs,
2248 [&](unsigned Use) { return TRI.regsOverlap(Use, Reg); }))
22272249 MO.setIsDead();
22282250 }
22292251
66 //
77 //===----------------------------------------------------------------------===//
88
9 #include "llvm/CodeGen/MachineModuleInfo.h"
10 #include "llvm/ADT/PointerUnion.h"
9 #include "llvm/ADT/ArrayRef.h"
10 #include "llvm/ADT/DenseMap.h"
1111 #include "llvm/ADT/PostOrderIterator.h"
12 #include "llvm/ADT/StringRef.h"
1213 #include "llvm/ADT/TinyPtrVector.h"
13 #include "llvm/Analysis/EHPersonalities.h"
14 #include "llvm/Analysis/ValueTracking.h"
1514 #include "llvm/CodeGen/MachineFunction.h"
1615 #include "llvm/CodeGen/MachineFunctionInitializer.h"
17 #include "llvm/CodeGen/MachineFunctionPass.h"
16 #include "llvm/CodeGen/MachineModuleInfo.h"
1817 #include "llvm/CodeGen/Passes.h"
19 #include "llvm/IR/Constants.h"
18 #include "llvm/IR/BasicBlock.h"
2019 #include "llvm/IR/DerivedTypes.h"
21 #include "llvm/IR/GlobalVariable.h"
2220 #include "llvm/IR/Instructions.h"
2321 #include "llvm/IR/Module.h"
24 #include "llvm/MC/MCObjectFileInfo.h"
22 #include "llvm/IR/Value.h"
23 #include "llvm/IR/ValueHandle.h"
24 #include "llvm/MC/MCContext.h"
2525 #include "llvm/MC/MCSymbol.h"
26 #include "llvm/Support/Dwarf.h"
26 #include "llvm/Pass.h"
27 #include "llvm/Support/Casting.h"
2728 #include "llvm/Support/ErrorHandling.h"
2829 #include "llvm/Target/TargetLoweringObjectFile.h"
2930 #include "llvm/Target/TargetMachine.h"
31 #include
32 #include
33 #include
34 #include
35 #include
36
3037 using namespace llvm;
3138 using namespace llvm::dwarf;
3239
3643 char MachineModuleInfo::ID = 0;
3744
3845 // Out of line virtual method.
39 MachineModuleInfoImpl::~MachineModuleInfoImpl() {}
46 MachineModuleInfoImpl::~MachineModuleInfoImpl() = default;
4047
4148 namespace llvm {
49
4250 class MMIAddrLabelMapCallbackPtr final : CallbackVH {
43 MMIAddrLabelMap *Map;
51 MMIAddrLabelMap *Map = nullptr;
52
4453 public:
45 MMIAddrLabelMapCallbackPtr() : Map(nullptr) {}
46 MMIAddrLabelMapCallbackPtr(Value *V) : CallbackVH(V), Map(nullptr) {}
54 MMIAddrLabelMapCallbackPtr() = default;
55 MMIAddrLabelMapCallbackPtr(Value *V) : CallbackVH(V) {}
4756
4857 void setPtr(BasicBlock *BB) {
4958 ValueHandleBase::operator=(BB);
7483 /// This is a per-function list of symbols whose corresponding BasicBlock got
7584 /// deleted. These symbols need to be emitted at some point in the file, so
7685 /// AsmPrinter emits them after the function body.
77 DenseMap, std::vector >
86 DenseMap, std::vector>
7887 DeletedAddrLabelsNeedingEmission;
88
7989 public:
80
8190 MMIAddrLabelMap(MCContext &context) : Context(context) {}
91
8292 ~MMIAddrLabelMap() {
8393 assert(DeletedAddrLabelsNeedingEmission.empty() &&
8494 "Some labels for deleted blocks never got emitted");
92102 void UpdateForDeletedBlock(BasicBlock *BB);
93103 void UpdateForRAUWBlock(BasicBlock *Old, BasicBlock *New);
94104 };
95 }
105
106 } // end namespace llvm
96107
97108 ArrayRef MMIAddrLabelMap::getAddrLabelSymbolToEmit(BasicBlock *BB) {
98109 assert(BB->hasAddressTaken() &&
118129 /// If we have any deleted symbols for F, return them.
119130 void MMIAddrLabelMap::
120131 takeDeletedSymbolsForFunction(Function *F, std::vector &Result) {
121 DenseMap, std::vector >::iterator I =
132 DenseMap, std::vector>::iterator I =
122133 DeletedAddrLabelsNeedingEmission.find(F);
123134
124135 // If there are no entries for the function, just return.
128139 std::swap(Result, I->second);
129140 DeletedAddrLabelsNeedingEmission.erase(I);
130141 }
131
132142
133143 void MMIAddrLabelMap::UpdateForDeletedBlock(BasicBlock *BB) {
134144 // If the block got deleted, there is no need for the symbol. If the symbol
176186 OldEntry.Symbols.end());
177187 }
178188
179
180189 void MMIAddrLabelMapCallbackPtr::deleted() {
181190 Map->UpdateForDeletedBlock(cast(getValPtr()));
182191 }
184193 void MMIAddrLabelMapCallbackPtr::allUsesReplacedWith(Value *V2) {
185194 Map->UpdateForRAUWBlock(cast(getValPtr()), cast(V2));
186195 }
187
188
189 //===----------------------------------------------------------------------===//
190196
191197 MachineModuleInfo::MachineModuleInfo(const TargetMachine *TM)
192198 : ImmutablePass(ID), TM(*TM),
195201 initializeMachineModuleInfoPass(*PassRegistry::getPassRegistry());
196202 }
197203
198 MachineModuleInfo::~MachineModuleInfo() {
199 }
204 MachineModuleInfo::~MachineModuleInfo() = default;
200205
201206 bool MachineModuleInfo::doInitialization(Module &M) {
202
203207 ObjFileMMI = nullptr;
204208 CurCallSite = 0;
205209 DbgInfoAvailable = UsesVAFloatArgument = UsesMorestackAddr = false;
210214 }
211215
212216 bool MachineModuleInfo::doFinalization(Module &M) {
213
214217 Personalities.clear();
215218
216219 delete AddrLabelSymbols;
289292 }
290293
291294 namespace {
295
292296 /// This pass frees the MachineFunction object associated with a Function.
293297 class FreeMachineFunction : public FunctionPass {
294298 public:
295299 static char ID;
300
296301 FreeMachineFunction() : FunctionPass(ID) {}
297302
298303 void getAnalysisUsage(AnalysisUsage &AU) const override {
310315 return "Free MachineFunction";
311316 }
312317 };
318
319 } // end anonymous namespace
320
313321 char FreeMachineFunction::ID;
314 } // end anonymous namespace
315
316 namespace llvm {
317 FunctionPass *createFreeMachineFunctionPass() {
322
323 FunctionPass *llvm::createFreeMachineFunctionPass() {
318324 return new FreeMachineFunction();
319325 }
320 } // end namespace llvm
321326
322327 //===- MMI building helpers -----------------------------------------------===//
323328
None //===-- Mips16FrameLowering.cpp - Mips16 Frame Information ----------------===//
0 //===- Mips16FrameLowering.cpp - Mips16 Frame Information -----------------===//
11 //
22 // The LLVM Compiler Infrastructure
33 //
1010 //
1111 //===----------------------------------------------------------------------===//
1212
13 #include "MCTargetDesc/MipsBaseInfo.h"
1314 #include "Mips16FrameLowering.h"
14 #include "MCTargetDesc/MipsBaseInfo.h"
1515 #include "Mips16InstrInfo.h"
1616 #include "MipsInstrInfo.h"
1717 #include "MipsRegisterInfo.h"
1818 #include "MipsSubtarget.h"
19 #include "llvm/ADT/BitVector.h"
20 #include "llvm/CodeGen/MachineBasicBlock.h"
1921 #include "llvm/CodeGen/MachineFrameInfo.h"
2022 #include "llvm/CodeGen/MachineFunction.h"
23 #include "llvm/CodeGen/MachineInstr.h"
2124 #include "llvm/CodeGen/MachineInstrBuilder.h"
2225 #include "llvm/CodeGen/MachineModuleInfo.h"
23 #include "llvm/CodeGen/MachineRegisterInfo.h"
24 #include "llvm/IR/DataLayout.h"
25 #include "llvm/IR/Function.h"
26 #include "llvm/Target/TargetOptions.h"
26 #include "llvm/IR/DebugLoc.h"
27 #include "llvm/MC/MachineLocation.h"
28 #include "llvm/MC/MCContext.h"
29 #include "llvm/MC/MCDwarf.h"
30 #include "llvm/MC/MCRegisterInfo.h"
31 #include "llvm/Support/MathExtras.h"
32 #include "llvm/Target/TargetFrameLowering.h"
33 #include
34 #include
35 #include
2736
2837 using namespace llvm;
2938
6271
6372 const std::vector &CSI = MFI.getCalleeSavedInfo();
6473
65 if (CSI.size()) {
74 if (!CSI.empty()) {
6675 const std::vector &CSI = MFI.getCalleeSavedInfo();
6776
6877 for (std::vector::const_iterator I = CSI.begin(),
7988 if (hasFP(MF))
8089 BuildMI(MBB, MBBI, dl, TII.get(Mips::MoveR3216), Mips::S0)
8190 .addReg(Mips::SP).setMIFlag(MachineInstr::FrameSetup);
82
8391 }
8492
8593 void Mips16FrameLowering::emitEpilogue(MachineFunction &MF,