diff options
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r-- | include/llvm/CodeGen/AsmPrinter.h | 2 | ||||
-rw-r--r-- | include/llvm/CodeGen/DIE.h | 42 | ||||
-rw-r--r-- | include/llvm/CodeGen/LiveInterval.h | 6 | ||||
-rw-r--r-- | include/llvm/CodeGen/RegisterPressure.h | 39 | ||||
-rw-r--r-- | include/llvm/CodeGen/WinEHFuncInfo.h | 5 |
5 files changed, 83 insertions, 11 deletions
diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h index f5e778b..cf29fc9 100644 --- a/include/llvm/CodeGen/AsmPrinter.h +++ b/include/llvm/CodeGen/AsmPrinter.h @@ -259,7 +259,7 @@ public: void EmitAlignment(unsigned NumBits, const GlobalObject *GO = nullptr) const; /// Lower the specified LLVM Constant to an MCExpr. - const MCExpr *lowerConstant(const Constant *CV); + virtual const MCExpr *lowerConstant(const Constant *CV); /// \brief Print a general LLVM constant to the .s file. void EmitGlobalConstant(const DataLayout &DL, const Constant *CV); diff --git a/include/llvm/CodeGen/DIE.h b/include/llvm/CodeGen/DIE.h index fa612d9..72b3adc 100644 --- a/include/llvm/CodeGen/DIE.h +++ b/include/llvm/CodeGen/DIE.h @@ -29,6 +29,48 @@ class MCSymbol; class raw_ostream; class DwarfTypeUnit; +// AsmStreamerBase - A base abstract interface class defines methods that +// can be implemented to stream objects or can be implemented to +// calculate the size of the streamed objects. +// The derived classes will use an AsmPrinter to implement the methods. +// +// TODO: complete this interface and use it to merge EmitValue and SizeOf +// methods in the DIE classes below. +class AsmStreamerBase { +protected: + const AsmPrinter *AP; + AsmStreamerBase(const AsmPrinter *AP) : AP(AP) {} + +public: + virtual ~AsmStreamerBase() {} + virtual unsigned emitULEB128(uint64_t Value, const char *Desc = nullptr, + unsigned PadTo = 0) = 0; + virtual unsigned emitInt8(unsigned char Value) = 0; + virtual unsigned emitBytes(StringRef Data) = 0; +}; + +/// EmittingAsmStreamer - Implements AbstractAsmStreamer to stream objects. +/// Notice that the return value is not the actual size of the streamed object. +/// For size calculation use SizeReporterAsmStreamer. +class EmittingAsmStreamer : public AsmStreamerBase { +public: + EmittingAsmStreamer(const AsmPrinter *AP) : AsmStreamerBase(AP) {} + unsigned emitULEB128(uint64_t Value, const char *Desc = nullptr, + unsigned PadTo = 0) override; + unsigned emitInt8(unsigned char Value) override; + unsigned emitBytes(StringRef Data) override; +}; + +/// SizeReporterAsmStreamer - Only reports the size of the streamed objects. +class SizeReporterAsmStreamer : public AsmStreamerBase { +public: + SizeReporterAsmStreamer(const AsmPrinter *AP) : AsmStreamerBase(AP) {} + unsigned emitULEB128(uint64_t Value, const char *Desc = nullptr, + unsigned PadTo = 0) override; + unsigned emitInt8(unsigned char Value) override; + unsigned emitBytes(StringRef Data) override; +}; + //===--------------------------------------------------------------------===// /// DIEAbbrevData - Dwarf abbreviation data, describes one attribute of a /// Dwarf abbreviation. diff --git a/include/llvm/CodeGen/LiveInterval.h b/include/llvm/CodeGen/LiveInterval.h index 0157bf9..edade31 100644 --- a/include/llvm/CodeGen/LiveInterval.h +++ b/include/llvm/CodeGen/LiveInterval.h @@ -848,9 +848,9 @@ namespace llvm { public: explicit ConnectedVNInfoEqClasses(LiveIntervals &lis) : LIS(lis) {} - /// Classify - Classify the values in LI into connected components. - /// Return the number of connected components. - unsigned Classify(const LiveInterval *LI); + /// Classify the values in \p LR into connected components. + /// Returns the number of connected components. + unsigned Classify(const LiveRange &LR); /// getEqClass - Classify creates equivalence classes numbered 0..N. Return /// the equivalence class assigned the VNI. diff --git a/include/llvm/CodeGen/RegisterPressure.h b/include/llvm/CodeGen/RegisterPressure.h index 987634f..9bbdf3e 100644 --- a/include/llvm/CodeGen/RegisterPressure.h +++ b/include/llvm/CodeGen/RegisterPressure.h @@ -141,6 +141,28 @@ public: LLVM_DUMP_METHOD void dump(const TargetRegisterInfo &TRI) const; }; +/// List of registers defined and used by a machine instruction. +class RegisterOperands { +public: + /// List of virtual regiserts and register units read by the instruction. + SmallVector<unsigned, 8> Uses; + /// \brief List of virtual registers and register units defined by the + /// instruction which are not dead. + SmallVector<unsigned, 8> Defs; + /// \brief List of virtual registers and register units defined by the + /// instruction but dead. + SmallVector<unsigned, 8> DeadDefs; + + /// Analyze the given instruction \p MI and fill in the Uses, Defs and + /// DeadDefs list based on the MachineOperand flags. + void collect(const MachineInstr &MI, const TargetRegisterInfo &TRI, + const MachineRegisterInfo &MRI, bool IgnoreDead = false); + + /// Use liveness information to find dead defs not marked with a dead flag + /// and move them to the DeadDefs vector. + void detectDeadDefs(const MachineInstr &MI, const LiveIntervals &LIS); +}; + /// Array of PressureDiffs. class PressureDiffs { PressureDiff *PDiffArray; @@ -161,6 +183,10 @@ public: const PressureDiff &operator[](unsigned Idx) const { return const_cast<PressureDiffs*>(this)->operator[](Idx); } + /// \brief Record pressure difference induced by the given operand list to + /// node with index \p Idx. + void addInstruction(unsigned Idx, const RegisterOperands &RegOpers, + const MachineRegisterInfo &MRI); }; /// Store the effects of a change in pressure on things that MI scheduler cares @@ -329,8 +355,17 @@ public: void setPos(MachineBasicBlock::const_iterator Pos) { CurrPos = Pos; } /// Recede across the previous instruction. - void recede(SmallVectorImpl<unsigned> *LiveUses = nullptr, - PressureDiff *PDiff = nullptr); + void recede(SmallVectorImpl<unsigned> *LiveUses = nullptr); + + /// Recede across the previous instruction. + /// This "low-level" variant assumes that recedeSkipDebugValues() was + /// called previously and takes precomputed RegisterOperands for the + /// instruction. + void recede(const RegisterOperands &RegOpers, + SmallVectorImpl<unsigned> *LiveUses = nullptr); + + /// Recede until we find an instruction which is not a DebugValue. + void recedeSkipDebugValues(); /// Advance across the current instruction. void advance(); diff --git a/include/llvm/CodeGen/WinEHFuncInfo.h b/include/llvm/CodeGen/WinEHFuncInfo.h index f6ad7a8..46c1029 100644 --- a/include/llvm/CodeGen/WinEHFuncInfo.h +++ b/include/llvm/CodeGen/WinEHFuncInfo.h @@ -93,8 +93,6 @@ struct WinEHFuncInfo { DenseMap<const Instruction *, int> EHPadStateMap; DenseMap<const FuncletPadInst *, int> FuncletBaseStateMap; DenseMap<const InvokeInst *, int> InvokeStateMap; - DenseMap<const CatchReturnInst *, const BasicBlock *> - CatchRetSuccessorColorMap; DenseMap<MCSymbol *, std::pair<int, MCSymbol *>> LabelToStateMap; SmallVector<CxxUnwindMapEntry, 4> CxxUnwindMap; SmallVector<WinEHTryBlockMapEntry, 4> TryBlockMap; @@ -125,8 +123,5 @@ void calculateSEHStateNumbers(const Function *ParentFn, WinEHFuncInfo &FuncInfo); void calculateClrEHStateNumbers(const Function *Fn, WinEHFuncInfo &FuncInfo); - -void calculateCatchReturnSuccessorColors(const Function *Fn, - WinEHFuncInfo &FuncInfo); } #endif // LLVM_CODEGEN_WINEHFUNCINFO_H |