LLVM: include/llvm/LTO/legacy/ThinLTOCodeGenerator.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15#ifndef LLVM_LTO_LEGACY_THINLTOCODEGENERATOR_H

16#define LLVM_LTO_LEGACY_THINLTOCODEGENERATOR_H

17

28

29#include

30

31namespace llvm {

34

35

36

37

41

42

53

54

55

56

57

58

59

61public:

62

64

65

66

67

68

69

71

72

73

74

75

76

77

79

80

81

82

83

84

85

86

88

89

90

91

92

93

94

96 return ProducedBinaries;

97 }

98

99

100

101

102

103

105 return ProducedBinaryFiles;

106 }

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

137

138

139

140 void setCacheDir(std::string Path) { CacheOptions.Path = std::move(Path); }

141

142

143

144

147 CacheOptions.Policy.Interval.reset();

148 else

149 CacheOptions.Policy.Interval = std::chrono::seconds(Interval);

150 }

151

152

153

155 if (Expiration)

156 CacheOptions.Policy.Expiration = std::chrono::seconds(Expiration);

157 }

158

159

160

161

162

163

164

165

166

167

168

169

170

171

173 if (Percentage)

174 CacheOptions.Policy.MaxSizePercentageOfAvailableSpace = Percentage;

175 }

176

177

178

179

181 if (MaxSizeBytes)

182 CacheOptions.Policy.MaxSizeBytes = MaxSizeBytes;

183 }

184

185

186

188 if (MaxSizeFiles)

189 CacheOptions.Policy.MaxSizeFiles = MaxSizeFiles;

190 }

191

192

193

194

195

196 void setSaveTempsDir(std::string Path) { SaveTempsDir = std::move(Path); }

197

198

199

200

201

203 SavedObjectsDirectoryPath = std::move(Path);

204 }

205

206

207 void setCpu(std::string Cpu) { TMBuilder.MCpu = std::move(Cpu); }

208

209

210 void setAttr(std::string MAttr) { TMBuilder.MAttr = std::move(MAttr); }

211

212

214 TMBuilder.Options = std::move(Options);

215 }

216

217

218

220

221

223 TMBuilder.RelocModel = Model;

224 }

225

226

228 TMBuilder.CGOptLevel = CGOptLevel;

229 }

230

231

233 OptLevel = (NewOptLevel > 3) ? 3 : NewOptLevel;

234 }

235

236

238

239

240

242

243

245

246

247

248

249

250

251

252

253

254

255

256

258

259

260

261

262

263

266

267

268

269

273

274

275

276

277

280

281

282

283

284

289

290

291

292

295

296

297

298

300

301

302

303

304

305

308

309

310private:

311

313

314

315

316 std::vector<std::unique_ptr> ProducedBinaries;

317

318

319 std::vectorstd::string ProducedBinaryFiles;

320

321

322

323 std::vector<std::unique_ptrlto::InputFile> Modules;

324

325

326

328

329

331

332

333 CachingOptions CacheOptions;

334

335

336 std::string SaveTempsDir;

337

338

339 std::string SavedObjectsDirectoryPath;

340

341

342

343 bool DisableCodeGen = false;

344

345

346

347 bool CodeGenOnly = false;

348

349

350

351 bool Freestanding = false;

352

353

354 unsigned OptLevel = 3;

355

356

357

358 bool DebugPassManager = false;

359};

360}

361#endif

std::pair< uint64_t, uint64_t > Interval

ModuleSummaryIndex.h This file contains the declarations the classes that hold the module index and s...

StringSet - A set-like wrapper for the StringMap.

This interface provides simple read-only access to a block of memory, and provides simple methods for...

Class to hold module path string table and global value map, and encapsulate methods for operating on...

A Module instance is used to store all the information related to an LLVM module.

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

StringSet - A wrapper for StringMap that provides set-like functionality.

Primary interface to the complete machine description for the target machine.

This class define an interface similar to the LTOCodeGenerator, but adapted for ThinLTO processing.

Definition ThinLTOCodeGenerator.h:60

LLVM_ABI void preserveSymbol(StringRef Name)

Adds to a list of all global symbols that must exist in the final generated code.

std::vector< std::unique_ptr< MemoryBuffer > > & getProducedBinaries()

Return the "in memory" binaries produced by the code generator.

Definition ThinLTOCodeGenerator.h:95

LLVM_ABI void run()

Process all the modules that were added to the code generator in parallel.

LLVM_ABI void crossReferenceSymbol(StringRef Name)

Adds to a list of all global symbols that are cross-referenced between ThinLTO files.

LLVM_ABI void addModule(StringRef Identifier, StringRef Data)

Add given module to the code generator.

std::vector< std::string > & getProducedBinaryFiles()

Return the "on-disk" binaries produced by the code generator.

Definition ThinLTOCodeGenerator.h:104

Triple - Helper class for working with autoconf configuration names.

void setCacheDir(std::string Path)

Provide a path to a directory where to store the cached files for incremental build.

Definition ThinLTOCodeGenerator.h:140

void setCachePruningInterval(int Interval)

Cache policy: interval (seconds) between two prunes of the cache.

Definition ThinLTOCodeGenerator.h:145

void setCacheEntryExpiration(unsigned Expiration)

Cache policy: expiration (in seconds) for an entry.

Definition ThinLTOCodeGenerator.h:154

void setMaxCacheSizeRelativeToAvailableSpace(unsigned Percentage)

Sets the maximum cache size that can be persistent across build, in terms of percentage of the availa...

Definition ThinLTOCodeGenerator.h:172

void setCacheMaxSizeBytes(uint64_t MaxSizeBytes)

Cache policy: the maximum size for the cache directory in bytes.

Definition ThinLTOCodeGenerator.h:180

void setCacheMaxSizeFiles(unsigned MaxSizeFiles)

Cache policy: the maximum number of files in the cache directory.

Definition ThinLTOCodeGenerator.h:187

void setCpu(std::string Cpu)

CPU to use to initialize the TargetMachine.

Definition ThinLTOCodeGenerator.h:207

void disableCodeGen(bool Disable)

Disable CodeGen, only run the stages till codegen and stop.

Definition ThinLTOCodeGenerator.h:241

void setGeneratedObjectsDirectory(std::string Path)

Set the path to a directory where to save generated object files.

Definition ThinLTOCodeGenerator.h:202

void setTargetOptions(TargetOptions Options)

TargetMachine options.

Definition ThinLTOCodeGenerator.h:213

void setOptLevel(unsigned NewOptLevel)

IR optimization level: from 0 to 3.

Definition ThinLTOCodeGenerator.h:232

void setAttr(std::string MAttr)

Subtarget attributes.

Definition ThinLTOCodeGenerator.h:210

void setFreestanding(bool Enabled)

Enable the Freestanding mode: indicate that the optimizer should not assume builtins are present on t...

Definition ThinLTOCodeGenerator.h:219

void setSaveTempsDir(std::string Path)

Set the path to a directory where to save temporaries at various stages of the processing.

Definition ThinLTOCodeGenerator.h:196

void setCodeGenOnly(bool CGOnly)

Perform CodeGen only: disable all other stages.

Definition ThinLTOCodeGenerator.h:244

void setDebugPassManager(unsigned Enabled)

Enable or disable debug output for the new pass manager.

Definition ThinLTOCodeGenerator.h:237

void setCodePICModel(std::optional< Reloc::Model > Model)

CodeModel.

Definition ThinLTOCodeGenerator.h:222

void setCodeGenOptLevel(CodeGenOptLevel CGOptLevel)

CodeGen optimization level.

Definition ThinLTOCodeGenerator.h:227

LLVM_ABI void optimize(Module &Module)

Perform post-importing ThinLTO optimizations.

LLVM_ABI std::unique_ptr< ModuleSummaryIndex > linkCombinedIndex()

Produce the combined summary index from all the bitcode files: "thin-link".

LLVM_ABI void crossModuleImport(Module &Module, ModuleSummaryIndex &Index, const lto::InputFile &File)

Perform cross-module importing for the module identified by ModuleIdentifier.

LLVM_ABI void emitImports(Module &Module, StringRef OutputName, ModuleSummaryIndex &Index, const lto::InputFile &File)

Compute and emit the imported files for module at ModulePath.

LLVM_ABI void internalize(Module &Module, ModuleSummaryIndex &Index, const lto::InputFile &File)

Perform internalization.

LLVM_ABI void gatherImportedSummariesForModule(Module &Module, ModuleSummaryIndex &Index, ModuleToSummariesForIndexTy &ModuleToSummariesForIndex, GVSummaryPtrSet &DecSummaries, const lto::InputFile &File)

Compute the list of summaries and the subset of declaration summaries needed for importing into modul...

LLVM_ABI void promote(Module &Module, ModuleSummaryIndex &Index, const lto::InputFile &File)

Perform promotion and renaming of exported internal functions, and additionally resolve weak and link...

LLVM_ABI std::string writeGeneratedObject(int count, StringRef CacheEntryPath, const MemoryBuffer &OutputBuffer)

Write temporary object file to SavedObjectDirectoryPath, write symlink to Cache directory if needed.

ThinLTOCodeGeneratorImpl - Namespace used for ThinLTOCodeGenerator implementation details.

Definition ThinLTOCodeGenerator.h:38

This is an optimization pass for GlobalISel generic memory operations.

std::unordered_set< GlobalValueSummary * > GVSummaryPtrSet

A set of global value summary pointers.

std::map< std::string, GVSummaryMapTy, std::less<> > ModuleToSummariesForIndexTy

Map of a module name to the GUIDs and summaries we will import from that module.

CodeGenOptLevel

Code generation optimization level.

FunctionAddr VTableAddr uintptr_t uintptr_t Data

auto count(R &&Range, const E &Element)

Wrapper function around std::count to count the number of times an element Element occurs in the give...

@ Enabled

Convert any .debug_str_offsets tables to DWARF64 if needed.

Policy for the pruneCache() function.

Helper to gather options relevant to the target machine creation.

Definition ThinLTOCodeGenerator.h:43

LLVM_ABI std::unique_ptr< TargetMachine > create() const

std::string MCpu

Definition ThinLTOCodeGenerator.h:45

std::string MAttr

Definition ThinLTOCodeGenerator.h:46

Triple TheTriple

Definition ThinLTOCodeGenerator.h:44

TargetOptions Options

Definition ThinLTOCodeGenerator.h:47

std::optional< Reloc::Model > RelocModel

Definition ThinLTOCodeGenerator.h:48

CodeGenOptLevel CGOptLevel

Definition ThinLTOCodeGenerator.h:49

CachePruningPolicy Policy

Definition ThinLTOCodeGenerator.h:135

std::string Path

Definition ThinLTOCodeGenerator.h:134