1010#define LLVM_MC_MCWINEH_H
1111
1212#include " llvm/ADT/MapVector.h"
13+ #include " llvm/ADT/STLExtras.h"
14+ #include " llvm/Support/SMLoc.h"
1315#include < vector>
1416
1517namespace llvm {
@@ -42,6 +44,7 @@ struct FrameInfo {
4244 const MCSymbol *FuncletOrFuncEnd = nullptr ;
4345 const MCSymbol *ExceptionHandler = nullptr ;
4446 const MCSymbol *Function = nullptr ;
47+ SMLoc FunctionLoc;
4548 const MCSymbol *PrologEnd = nullptr ;
4649 const MCSymbol *Symbol = nullptr ;
4750 MCSection *TextSection = nullptr ;
@@ -52,16 +55,21 @@ struct FrameInfo {
5255 bool HandlesExceptions = false ;
5356 bool EmitAttempted = false ;
5457 bool Fragment = false ;
58+ constexpr static uint8_t DefaultVersion = 1 ;
59+ uint8_t Version = DefaultVersion;
5560
5661 int LastFrameInst = -1 ;
5762 const FrameInfo *ChainedParent = nullptr ;
5863 std::vector<Instruction> Instructions;
5964 struct Epilog {
6065 std::vector<Instruction> Instructions;
6166 unsigned Condition;
62- MCSymbol *End;
67+ const MCSymbol *Start = nullptr ;
68+ const MCSymbol *End = nullptr ;
69+ const MCSymbol *UnwindV2Start = nullptr ;
70+ SMLoc Loc;
6371 };
64- MapVector<MCSymbol *, Epilog> EpilogMap ;
72+ std::vector< Epilog> Epilogs ;
6573
6674 // For splitting unwind info of large functions
6775 struct Segment {
@@ -70,7 +78,11 @@ struct FrameInfo {
7078 bool HasProlog;
7179 MCSymbol *Symbol = nullptr ;
7280 // Map an Epilog's symbol to its offset within the function.
73- MapVector<MCSymbol *, int64_t > Epilogs;
81+ struct Epilog {
82+ const MCSymbol *Symbol;
83+ int64_t Offset;
84+ };
85+ std::vector<Epilog> Epilogs;
7486
7587 Segment (int64_t Offset, int64_t Length, bool HasProlog = false )
7688 : Offset(Offset), Length(Length), HasProlog(HasProlog) {}
@@ -89,11 +101,21 @@ struct FrameInfo {
89101 bool empty () const {
90102 if (!Instructions.empty ())
91103 return false ;
92- for (const auto &E : EpilogMap )
93- if (!E.second . Instructions .empty ())
104+ for (const auto &E : Epilogs )
105+ if (!E.Instructions .empty ())
94106 return false ;
95107 return true ;
96108 }
109+
110+ auto findEpilog (const MCSymbol *Start) const {
111+ return llvm::find_if (Epilogs,
112+ [Start](const Epilog &E) { return E.Start == Start; });
113+ }
114+
115+ auto findEpilog (const MCSymbol *Start) {
116+ return llvm::find_if (Epilogs,
117+ [Start](Epilog &E) { return E.Start == Start; });
118+ }
97119};
98120
99121class UnwindEmitter {
0 commit comments