Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "[Reland][DWARFLinkerParallel] Add limited functionality to DW…
…ARFLinkerParallel." This reverts commit 0229dd0. This introduces two test failures on s390x. tools/dsymutil/X86/location-expression.test: warning: cann't load line table. note: while processing CU1 /builddir/build/BUILD/llvm-18.0.0.src/test/tools/dsymutil/X86/location-expression.test:20:10: error: CHECK: expected string not found in input # CHECK: DW_AT_name{{.*}}"CU1" ^ <stdin>:34:32: note: scanning from here 0x0000000b: DW_TAG_compile_unit [1] * ^ <stdin>:37:2: note: possible intended match here DW_AT_name [DW_FORM_strp] ( .debug_str[0x09000000] = ) ^ tools/dsymutil/X86/tls-variable.test: warning: cann't load line table. note: while processing CU1 /builddir/build/BUILD/llvm-18.0.0.src/test/tools/dsymutil/X86/tls-variable.test:19:10: error: CHECK: expected string not found in input # CHECK: DW_AT_name{{.*}}"CU1" ^ <stdin>:26:32: note: scanning from here 0x0000000b: DW_TAG_compile_unit ^ <stdin>:29:2: note: possible intended match here DW_AT_name () ^
- Loading branch information
Showing
133 changed files
with
1,007 additions
and
8,485 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
//===- StringTable.h --------------------------------------------*- C++ -*-===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_DWARFLINKERPARALLEL_STRINGTABLE_H | ||
#define LLVM_DWARFLINKERPARALLEL_STRINGTABLE_H | ||
|
||
#include "llvm/ADT/SmallVector.h" | ||
#include "llvm/DWARFLinkerParallel/StringPool.h" | ||
|
||
namespace llvm { | ||
namespace dwarflinker_parallel { | ||
|
||
using StringsVector = SmallVector<StringEntry *>; | ||
|
||
/// This class prepares strings for emission into .debug_str table: | ||
/// translates string if necessary, assigns index and offset, keeps in order. | ||
class StringTable { | ||
public: | ||
StringTable(StringPool &Strings, | ||
std::function<StringRef(StringRef)> StringsTranslator) | ||
: Strings(Strings), StringsTranslator(StringsTranslator) {} | ||
~StringTable() {} | ||
|
||
/// Add string to the vector of strings which should be emitted. | ||
/// Translate input string if neccessary, assign index and offset. | ||
/// \returns updated string entry. | ||
StringEntry *add(StringEntry *String) { | ||
// Translate string if necessary. | ||
if (StringsTranslator) | ||
String = Strings.insert(StringsTranslator(String->first())).first; | ||
|
||
// Store String for emission and assign index and offset. | ||
if (String->getValue() == nullptr) { | ||
DwarfStringPoolEntry *NewEntry = | ||
Strings.getAllocatorRef().Allocate<DwarfStringPoolEntry>(); | ||
|
||
NewEntry->Symbol = nullptr; | ||
NewEntry->Index = StringEntriesForEmission.size(); | ||
|
||
if (StringEntriesForEmission.empty()) | ||
NewEntry->Offset = 0; | ||
else { | ||
StringEntry *PrevString = StringEntriesForEmission.back(); | ||
NewEntry->Offset = | ||
PrevString->getValue()->Offset + PrevString->getKeyLength() + 1; | ||
} | ||
|
||
String->getValue() = NewEntry; | ||
StringEntriesForEmission.push_back(String); | ||
} | ||
|
||
return String; | ||
} | ||
|
||
/// Erase contents of StringsForEmission. | ||
void clear() { StringEntriesForEmission.clear(); } | ||
|
||
/// Enumerate all strings in sequential order and call \p Handler for each | ||
/// string. | ||
void forEach(function_ref<void(DwarfStringPoolEntryRef)> Handler) const { | ||
for (const StringEntry *Entry : StringEntriesForEmission) | ||
Handler(*Entry); | ||
} | ||
|
||
std::function<StringRef(StringRef)> getTranslator() { | ||
return StringsTranslator; | ||
} | ||
|
||
protected: | ||
/// List of strings for emission. | ||
StringsVector StringEntriesForEmission; | ||
|
||
/// String pool for the translated strings. | ||
StringPool &Strings; | ||
|
||
/// Translator for the strings. | ||
std::function<StringRef(StringRef)> StringsTranslator; | ||
}; | ||
|
||
} // end of namespace dwarflinker_parallel | ||
} // end namespace llvm | ||
|
||
#endif // LLVM_DWARFLINKERPARALLEL_STRINGTABLE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.