@@ -1777,23 +1777,7 @@ void FrameEmitterImpl::EmitFDE(const MCSymbol &cieStart,
1777
1777
namespace {
1778
1778
1779
1779
struct CIEKey {
1780
- static const CIEKey getEmptyKey () {
1781
- return CIEKey (nullptr , 0 , -1 , false , false , static_cast <unsigned >(INT_MAX),
1782
- false , false );
1783
- }
1784
-
1785
- static const CIEKey getTombstoneKey () {
1786
- return CIEKey (nullptr , -1 , 0 , false , false , static_cast <unsigned >(INT_MAX),
1787
- false , false );
1788
- }
1789
-
1790
- CIEKey (const MCSymbol *Personality, unsigned PersonalityEncoding,
1791
- unsigned LSDAEncoding, bool IsSignalFrame, bool IsSimple,
1792
- unsigned RAReg, bool IsBKeyFrame, bool IsMTETaggedFrame)
1793
- : Personality(Personality), PersonalityEncoding(PersonalityEncoding),
1794
- LsdaEncoding (LSDAEncoding), IsSignalFrame(IsSignalFrame),
1795
- IsSimple(IsSimple), RAReg(RAReg), IsBKeyFrame(IsBKeyFrame),
1796
- IsMTETaggedFrame(IsMTETaggedFrame) {}
1780
+ CIEKey () = default ;
1797
1781
1798
1782
explicit CIEKey (const MCDwarfFrameInfo &Frame)
1799
1783
: Personality(Frame.Personality),
@@ -1819,44 +1803,28 @@ struct CIEKey {
1819
1803
Other.IsMTETaggedFrame );
1820
1804
}
1821
1805
1822
- const MCSymbol *Personality;
1823
- unsigned PersonalityEncoding;
1824
- unsigned LsdaEncoding;
1825
- bool IsSignalFrame;
1826
- bool IsSimple;
1827
- unsigned RAReg;
1828
- bool IsBKeyFrame;
1829
- bool IsMTETaggedFrame;
1806
+ bool operator ==(const CIEKey &Other) const {
1807
+ return Personality == Other.Personality &&
1808
+ PersonalityEncoding == Other.PersonalityEncoding &&
1809
+ LsdaEncoding == Other.LsdaEncoding &&
1810
+ IsSignalFrame == Other.IsSignalFrame && IsSimple == Other.IsSimple &&
1811
+ RAReg == Other.RAReg && IsBKeyFrame == Other.IsBKeyFrame &&
1812
+ IsMTETaggedFrame == Other.IsMTETaggedFrame ;
1813
+ }
1814
+ bool operator !=(const CIEKey &Other) const { return !(*this == Other); }
1815
+
1816
+ const MCSymbol *Personality = nullptr ;
1817
+ unsigned PersonalityEncoding = 0 ;
1818
+ unsigned LsdaEncoding = -1 ;
1819
+ bool IsSignalFrame = false ;
1820
+ bool IsSimple = false ;
1821
+ unsigned RAReg = static_cast <unsigned >(UINT_MAX);
1822
+ bool IsBKeyFrame = false ;
1823
+ bool IsMTETaggedFrame = false ;
1830
1824
};
1831
1825
1832
1826
} // end anonymous namespace
1833
1827
1834
- namespace llvm {
1835
-
1836
- template <> struct DenseMapInfo <CIEKey> {
1837
- static CIEKey getEmptyKey () { return CIEKey::getEmptyKey (); }
1838
- static CIEKey getTombstoneKey () { return CIEKey::getTombstoneKey (); }
1839
-
1840
- static unsigned getHashValue (const CIEKey &Key) {
1841
- return static_cast <unsigned >(
1842
- hash_combine (Key.Personality , Key.PersonalityEncoding , Key.LsdaEncoding ,
1843
- Key.IsSignalFrame , Key.IsSimple , Key.RAReg ,
1844
- Key.IsBKeyFrame , Key.IsMTETaggedFrame ));
1845
- }
1846
-
1847
- static bool isEqual (const CIEKey &LHS, const CIEKey &RHS) {
1848
- return LHS.Personality == RHS.Personality &&
1849
- LHS.PersonalityEncoding == RHS.PersonalityEncoding &&
1850
- LHS.LsdaEncoding == RHS.LsdaEncoding &&
1851
- LHS.IsSignalFrame == RHS.IsSignalFrame &&
1852
- LHS.IsSimple == RHS.IsSimple && LHS.RAReg == RHS.RAReg &&
1853
- LHS.IsBKeyFrame == RHS.IsBKeyFrame &&
1854
- LHS.IsMTETaggedFrame == RHS.IsMTETaggedFrame ;
1855
- }
1856
- };
1857
-
1858
- } // end namespace llvm
1859
-
1860
1828
void MCDwarfFrameEmitter::Emit (MCObjectStreamer &Streamer, MCAsmBackend *MAB,
1861
1829
bool IsEH) {
1862
1830
MCContext &Context = Streamer.getContext ();
@@ -1898,9 +1866,6 @@ void MCDwarfFrameEmitter::Emit(MCObjectStreamer &Streamer, MCAsmBackend *MAB,
1898
1866
MCSymbol *SectionStart = Context.createTempSymbol ();
1899
1867
Streamer.emitLabel (SectionStart);
1900
1868
1901
- DenseMap<CIEKey, const MCSymbol *> CIEStarts;
1902
-
1903
- const MCSymbol *DummyDebugKey = nullptr ;
1904
1869
bool CanOmitDwarf = MOFI->getOmitDwarfIfHaveCompactUnwind ();
1905
1870
// Sort the FDEs by their corresponding CIE before we emit them.
1906
1871
// This isn't technically necessary according to the DWARF standard,
@@ -1911,6 +1876,8 @@ void MCDwarfFrameEmitter::Emit(MCObjectStreamer &Streamer, MCAsmBackend *MAB,
1911
1876
[](const MCDwarfFrameInfo &X, const MCDwarfFrameInfo &Y) {
1912
1877
return CIEKey (X) < CIEKey (Y);
1913
1878
});
1879
+ CIEKey LastKey;
1880
+ const MCSymbol *LastCIEStart = nullptr ;
1914
1881
for (auto I = FrameArrayX.begin (), E = FrameArrayX.end (); I != E;) {
1915
1882
const MCDwarfFrameInfo &Frame = *I;
1916
1883
++I;
@@ -1925,11 +1892,12 @@ void MCDwarfFrameEmitter::Emit(MCObjectStreamer &Streamer, MCAsmBackend *MAB,
1925
1892
continue ;
1926
1893
1927
1894
CIEKey Key (Frame);
1928
- const MCSymbol *&CIEStart = IsEH ? CIEStarts[Key] : DummyDebugKey;
1929
- if (!CIEStart)
1930
- CIEStart = &Emitter.EmitCIE (Frame);
1895
+ if (!LastCIEStart || (IsEH && Key != LastKey)) {
1896
+ LastKey = Key;
1897
+ LastCIEStart = &Emitter.EmitCIE (Frame);
1898
+ }
1931
1899
1932
- Emitter.EmitFDE (*CIEStart , Frame, I == E, *SectionStart);
1900
+ Emitter.EmitFDE (*LastCIEStart , Frame, I == E, *SectionStart);
1933
1901
}
1934
1902
}
1935
1903
0 commit comments