Skip to content

Commit 8fc1687

Browse files
committed
Make the async code more self-contained
1 parent 244bc70 commit 8fc1687

File tree

2 files changed

+473
-326
lines changed

2 files changed

+473
-326
lines changed

llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -53,27 +53,14 @@ class ModuleCacheEntry {
5353
// Access the path to this entry in the cache.
5454
virtual std::string getEntryPath() = 0;
5555

56-
/// Attempt to asynchronously load the cached buffer and invoke the callback.
57-
/// Cache miss is represented as std::error_code().
58-
virtual void tryLoadingBuffer(
59-
std::function<void(ErrorOr<std::unique_ptr<MemoryBuffer>>)> Cb) = 0;
60-
61-
/// Attempt to asynchronously write the computed buffer and invoke the
62-
/// callback.
63-
virtual void write(const MemoryBuffer &OutputBuffer,
64-
std::function<void()> Cb) = 0;
65-
56+
virtual ErrorOr<std::unique_ptr<MemoryBuffer>> tryLoadingBuffer() = 0;
57+
virtual void write(const MemoryBuffer &OutputBuffer) = 0;
6658
virtual Error writeObject(const MemoryBuffer &OutputBuffer,
6759
StringRef OutputPath);
6860
virtual std::optional<std::unique_ptr<MemoryBuffer>> getMappedBuffer() {
6961
return std::nullopt;
7062
}
7163

72-
/// Check whether the loaded and written results of this entry are identical.
73-
/// This is only called when DeterministicCheck is enabled, and after both
74-
/// \c tryLoadingBuffer() and \c write() have finished.
75-
virtual bool areLoadedAndWrittenResultsIdentical() const { return true; }
76-
7764
virtual ~ModuleCacheEntry() {}
7865

7966
static std::optional<std::string> computeCacheKey(
@@ -85,8 +72,6 @@ class ModuleCacheEntry {
8572
bool Freestanding, const TargetMachineBuilder &TMBuilder);
8673
};
8774

88-
struct CancellationToken;
89-
9075
/// This class define an interface similar to the LTOCodeGenerator, but adapted
9176
/// for ThinLTO processing.
9277
/// The ThinLTOCodeGenerator is not intended to be reuse for multiple
@@ -185,8 +170,6 @@ class ThinLTOCodeGenerator {
185170

186171
/// Create a cache entry for the module
187172
std::unique_ptr<ModuleCacheEntry> createModuleCacheEntry(
188-
std::shared_ptr<CancellationToken> GetCancelTok,
189-
std::shared_ptr<CancellationToken> PutCancelTok,
190173
const ModuleSummaryIndex &Index, StringRef ModuleID, StringRef OutputPath,
191174
const FunctionImporter::ImportMapTy &ImportList,
192175
const FunctionImporter::ExportSetTy &ExportList,

0 commit comments

Comments
 (0)