LLVM: include/llvm/Support/Caching.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15#ifndef LLVM_SUPPORT_CACHING_H

16#define LLVM_SUPPORT_CACHING_H

17

21

22namespace llvm {

23

24

25

26

27

28

30public:

32 std::string OSPath = "")

34

35

36

40 Twine("CacheStream already committed."));

42

44 }

45

47 std::unique_ptr<raw_pwrite_stream> OS;

53};

54

55

56

57

58using AddStreamFn = std::function<Expected<std::unique_ptr>(

60

61

62

63

64

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

86 : CacheFunction(std::move(CacheFn)), CacheDirectoryPath(DirectoryPath) {}

88

95 return CacheDirectoryPath;

96 }

97 bool isValid() const { return static_cast<bool>(CacheFunction); }

98

99private:

101 std::string CacheDirectoryPath;

102};

103

104

105

106

108 std::unique_ptr MB)>;

109

110

111

112

113

114

115

117 const Twine &CacheNameRef, const Twine &TempFilePrefixRef,

118 const Twine &CacheDirectoryPathRef,

120 std::unique_ptr MB) {});

121}

122

123#endif

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

CachedFileStream(std::unique_ptr< raw_pwrite_stream > OS, std::string OSPath="")

Definition Caching.h:31

std::string ObjectPathName

Definition Caching.h:48

virtual ~CachedFileStream()

Definition Caching.h:49

std::unique_ptr< raw_pwrite_stream > OS

Definition Caching.h:47

bool Committed

Definition Caching.h:46

virtual Error commit()

Must be called exactly once after the writes to OS have been completed but before the CachedFileStrea...

Definition Caching.h:37

Lightweight error class with error context and mandatory checking.

static ErrorSuccess success()

Create a success value.

Tagged union holding either a T or a Error.

StringRef - Represent a constant reference to a string, i.e.

Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...

This is an optimization pass for GlobalISel generic memory operations.

std::error_code make_error_code(BitcodeError E)

Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)

Create formatted StringError object.

std::function< Expected< AddStreamFn >( unsigned Task, StringRef Key, const Twine &ModuleName)> FileCacheFunction

This is a callable that manages file caching operations.

Definition Caching.h:65

std::function< void(unsigned Task, const Twine &ModuleName, std::unique_ptr< MemoryBuffer > MB)> AddBufferFn

This type defines the callback to add a pre-existing file (e.g.

Definition Caching.h:107

LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)

LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key

OutputIt move(R &&Range, OutputIt Out)

Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.

std::function< Expected< std::unique_ptr< CachedFileStream > >( unsigned Task, const Twine &ModuleName)> AddStreamFn

This type defines the callback to add a file that is generated on the fly.

Definition Caching.h:58

LLVM_ABI Expected< FileCache > localCache(const Twine &CacheNameRef, const Twine &TempFilePrefixRef, const Twine &CacheDirectoryPathRef, AddBufferFn AddBuffer=[](size_t Task, const Twine &ModuleName, std::unique_ptr< MemoryBuffer > MB) {})

Create a local file system cache which uses the given cache name, temporary file prefix,...

Implement std::hash so that hash_code can be used in STL containers.

Expected< AddStreamFn > operator()(unsigned Task, StringRef Key, const Twine &ModuleName)

Definition Caching.h:89

const std::string & getCacheDirectoryPath() const

Definition Caching.h:94

bool isValid() const

Definition Caching.h:97

FileCache(FileCacheFunction CacheFn, const std::string &DirectoryPath)

Definition Caching.h:85