@@ -47,13 +47,6 @@ struct MipsRelocationEntry {
4747 }
4848};
4949
50- #ifndef NDEBUG
51- raw_ostream &operator <<(raw_ostream &OS, const MipsRelocationEntry &RHS) {
52- RHS.print (OS);
53- return OS;
54- }
55- #endif
56-
5750class MipsELFObjectWriter : public MCELFObjectTargetWriter {
5851public:
5952 MipsELFObjectWriter (uint8_t OSABI, bool HasRelocationAddend, bool Is64);
@@ -115,17 +108,11 @@ static InputIt find_best(InputIt First, InputIt Last, UnaryPredicate Predicate,
115108 for (InputIt I = First; I != Last; ++I) {
116109 unsigned Matched = Predicate (*I);
117110 if (Matched != FindBest_NoMatch) {
118- LLVM_DEBUG (dbgs () << std::distance (First, I) << " is a match (" ;
119- I->print (dbgs ()); dbgs () << " )\n " );
120- if (Best == Last || BetterThan (*I, *Best)) {
121- LLVM_DEBUG (dbgs () << " .. and it beats the last one\n " );
111+ if (Best == Last || BetterThan (*I, *Best))
122112 Best = I;
123- }
124113 }
125- if (Matched == FindBest_PerfectMatch) {
126- LLVM_DEBUG (dbgs () << " .. and it is unbeatable\n " );
114+ if (Matched == FindBest_PerfectMatch)
127115 break ;
128- }
129116 }
130117
131118 return Best;
@@ -201,15 +188,6 @@ static bool compareMatchingRelocs(const MipsRelocationEntry &Candidate,
201188 return PreviousBest.Matched && !Candidate.Matched ;
202189}
203190
204- #ifndef NDEBUG
205- // / Print all the relocations.
206- template <class Container >
207- static void dumpRelocs (const char *Prefix, const Container &Relocs) {
208- for (const auto &R : Relocs)
209- dbgs () << Prefix << R << " \n " ;
210- }
211- #endif
212-
213191MipsELFObjectWriter::MipsELFObjectWriter (uint8_t OSABI,
214192 bool HasRelocationAddend, bool Is64)
215193 : MCELFObjectTargetWriter(Is64, OSABI, ELF::EM_MIPS, HasRelocationAddend) {}
@@ -448,8 +426,6 @@ void MipsELFObjectWriter::sortRelocs(const MCAssembler &Asm,
448426 std::list<MipsRelocationEntry> Sorted;
449427 std::list<ELFRelocationEntry> Remainder;
450428
451- LLVM_DEBUG (dumpRelocs (" R: " , Relocs));
452-
453429 // Separate the movable relocations (AHL relocations using the high bits) from
454430 // the immobile relocations (everything else). This does not preserve high/low
455431 // matches that already existed in the input.
@@ -459,8 +435,6 @@ void MipsELFObjectWriter::sortRelocs(const MCAssembler &Asm,
459435 });
460436
461437 for (auto &R : Remainder) {
462- LLVM_DEBUG (dbgs () << " Matching: " << R << " \n " );
463-
464438 unsigned MatchingType = getMatchingLoType (R);
465439 assert (MatchingType != ELF::R_MIPS_NONE &&
466440 " Wrong list for reloc that doesn't need a match" );
@@ -494,8 +468,6 @@ void MipsELFObjectWriter::sortRelocs(const MCAssembler &Asm,
494468 Sorted.insert (InsertionPoint, R)->Matched = true ;
495469 }
496470
497- LLVM_DEBUG (dumpRelocs (" S: " , Sorted));
498-
499471 assert (Relocs.size () == Sorted.size () && " Some relocs were not consumed" );
500472
501473 // Overwrite the original vector with the sorted elements.
0 commit comments