llvm.org GIT mirror llvm / d5fb525
Revert "[dsymutil] Gather function ranges during DIE selection." This reverts commit r231957. IntervalMap currently doesn't support keys more aligned than host pointers and I've been using it with uint64_t keys. This asserts on some 32bits systems. Revert while I work on an IntervalMap generalization. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231967 91177308-0d34-0410-b5e6-96231b3b80d8 Frederic Riss 5 years ago
1 changed file(s) with 4 addition(s) and 47 deletion(s). Raw diff Collapse all Expand all
99 #include "BinaryHolder.h"
1010 #include "DebugMap.h"
1111 #include "dsymutil.h"
12 #include "llvm/ADT/IntervalMap.h"
1312 #include "llvm/ADT/StringMap.h"
1413 #include "llvm/ADT/STLExtras.h"
1514 #include "llvm/CodeGen/AsmPrinter.h"
4948 return false;
5049 }
5150
52 template
53 using HalfOpenIntervalMap =
54 IntervalMap::LeafSize,
55 IntervalMapHalfOpenInfo>;
56
5751 /// \brief Stores all information relating to a compile unit, be it in
5852 /// its original instance in the object file to its brand new cloned
5953 /// and linked DIE tree.
6862 bool InDebugMap; ///< Was this DIE's entity found in the map?
6963 };
7064
71 CompileUnit(DWARFUnit &OrigUnit)
72 : OrigUnit(OrigUnit), RangeAlloc(), Ranges(RangeAlloc) {
65 CompileUnit(DWARFUnit &OrigUnit) : OrigUnit(OrigUnit) {
7366 Info.resize(OrigUnit.getNumDIEs());
7467 }
7568
69 // Workaround MSVC not supporting implicit move ops
7670 CompileUnit(CompileUnit &&RHS)
7771 : OrigUnit(RHS.OrigUnit), Info(std::move(RHS.Info)),
7872 CUDie(std::move(RHS.CUDie)), StartOffset(RHS.StartOffset),
79 NextUnitOffset(RHS.NextUnitOffset), RangeAlloc(), Ranges(RangeAlloc) {
80 // The CompileUnit container has been 'reserve()'d with the right
81 // size. We cannot move the IntervalMap anyway.
82 llvm_unreachable("CompileUnits should not be moved.");
83 }
73 NextUnitOffset(RHS.NextUnitOffset) {}
8474
8575 DWARFUnit &getOrigUnit() const { return OrigUnit; }
8676
10898
10999 /// \brief Apply all fixups recored by noteForwardReference().
110100 void fixupForwardReferences();
111
112 /// \brief Add a function range [\p LowPC, \p HighPC) that is
113 /// relocatad by applying offset \p PCOffset.
114 void addFunctionRange(uint64_t LowPC, uint64_t HighPC, int64_t PCOffset);
115101
116102 private:
117103 DWARFUnit &OrigUnit;
128114 /// cloning because for forward refences the target DIE's offset isn't
129115 /// known you emit the reference attribute.
130116 std::vector> ForwardDIEReferences;
131
132 HalfOpenIntervalMap::Allocator RangeAlloc;
133 /// \brief The ranges in that interval map are the PC ranges for
134 /// functions in this unit, associated with the PC offset to apply
135 /// to the addresses to get the linked address.
136 HalfOpenIntervalMap Ranges;
137117 };
138118
139119 uint64_t CompileUnit::computeNextUnitOffset() {
155135 void CompileUnit::fixupForwardReferences() {
156136 for (const auto &Ref : ForwardDIEReferences)
157137 Ref.second->setValue(Ref.first->getOffset() + getStartOffset());
158 }
159
160 void CompileUnit::addFunctionRange(uint64_t LowPC, uint64_t HighPC,
161 int64_t PCOffset) {
162 Ranges.insert(LowPC, HighPC, PCOffset);
163138 }
164139
165140 /// \brief A string table that doesn't need relocations.
968943 if (Options.Verbose)
969944 DIE.dump(outs(), const_cast(&OrigUnit), 0, 8 /* Indent */);
970945
971 Flags |= TF_Keep;
972
973 DWARFFormValue HighPcValue;
974 if (!DIE.getAttributeValue(&OrigUnit, dwarf::DW_AT_high_pc, HighPcValue)) {
975 reportWarning("Function without high_pc. Range will be discarded.\n",
976 &OrigUnit, &DIE);
977 return Flags;
978 }
979
980 uint64_t HighPc;
981 if (HighPcValue.isFormClass(DWARFFormValue::FC_Address)) {
982 HighPc = *HighPcValue.getAsAddress(&OrigUnit);
983 } else {
984 assert(HighPcValue.isFormClass(DWARFFormValue::FC_Constant));
985 HighPc = LowPc + *HighPcValue.getAsUnsignedConstant();
986 }
987
988 Unit.addFunctionRange(LowPc, HighPc, MyInfo.AddrAdjust);
989 return Flags;
946 return Flags | TF_Keep;
990947 }
991948
992949 /// \brief Check if a DIE should be kept.