LLVM  16.0.0git
LTOCodeGenerator.cpp
Go to the documentation of this file.
1 //===-LTOCodeGenerator.cpp - LLVM Link Time Optimizer ---------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the Link Time Optimization library. This library is
10 // intended to be used by linker to optimize code at link time.
11 //
12 //===----------------------------------------------------------------------===//
13 
15 
16 #include "llvm/ADT/Statistic.h"
17 #include "llvm/ADT/StringExtras.h"
18 #include "llvm/Analysis/Passes.h"
25 #include "llvm/Config/config.h"
26 #include "llvm/IR/Constants.h"
27 #include "llvm/IR/DataLayout.h"
28 #include "llvm/IR/DebugInfo.h"
29 #include "llvm/IR/DerivedTypes.h"
30 #include "llvm/IR/DiagnosticInfo.h"
32 #include "llvm/IR/LLVMContext.h"
35 #include "llvm/IR/Mangler.h"
36 #include "llvm/IR/Module.h"
37 #include "llvm/IR/PassTimingInfo.h"
38 #include "llvm/IR/Verifier.h"
39 #include "llvm/InitializePasses.h"
40 #include "llvm/LTO/LTO.h"
41 #include "llvm/LTO/LTOBackend.h"
44 #include "llvm/Linker/Linker.h"
45 #include "llvm/MC/MCAsmInfo.h"
46 #include "llvm/MC/MCContext.h"
48 #include "llvm/MC/TargetRegistry.h"
52 #include "llvm/Support/Host.h"
54 #include "llvm/Support/Process.h"
55 #include "llvm/Support/Signals.h"
61 #include "llvm/Transforms/IPO.h"
67 #include <system_error>
68 using namespace llvm;
69 
71  return PACKAGE_NAME " version " PACKAGE_VERSION;
72 }
73 
74 namespace llvm {
76  "lto-discard-value-names",
77  cl::desc("Strip names from Value during LTO (other than GlobalValue)."),
78 #ifdef NDEBUG
79  cl::init(true),
80 #else
81  cl::init(false),
82 #endif
83  cl::Hidden);
84 
86  "lto-pass-remarks-with-hotness",
87  cl::desc("With PGO, include profile count in optimization remarks"),
88  cl::Hidden);
89 
92  "lto-pass-remarks-hotness-threshold",
93  cl::desc("Minimum profile count required for an "
94  "optimization remark to be output."
95  " Use 'auto' to apply the threshold from profile summary."),
96  cl::value_desc("uint or 'auto'"), cl::init(0), cl::Hidden);
97 
99  RemarksFilename("lto-pass-remarks-output",
100  cl::desc("Output filename for pass remarks"),
101  cl::value_desc("filename"));
102 
104  RemarksPasses("lto-pass-remarks-filter",
105  cl::desc("Only record optimization remarks from passes whose "
106  "names match the given regular expression"),
107  cl::value_desc("regex"));
108 
110  "lto-pass-remarks-format",
111  cl::desc("The format used for serializing remarks (default: YAML)"),
112  cl::value_desc("format"), cl::init("yaml"));
113 
115  "lto-stats-file",
116  cl::desc("Save statistics to the specified file"),
117  cl::Hidden);
118 
120  "lto-aix-system-assembler",
121  cl::desc("Absolute path to the system assembler, picked up on AIX only"),
122  cl::value_desc("path"));
123 }
124 
126  : Context(Context), MergedModule(new Module("ld-temp.o", Context)),
127  TheLinker(new Linker(*MergedModule)) {
130 
131  Config.CodeModel = None;
132  Config.StatsFile = LTOStatsFile;
133  Config.PreCodeGenPassesHook = [](legacy::PassManager &PM) {
134  PM.add(createObjCARCContractPass());
135  };
136 }
137 
139 
141  for (const StringRef &Undef : Mod->getAsmUndefinedRefs())
142  AsmUndefinedRefs.insert(Undef);
143 }
144 
146  assert(&Mod->getModule().getContext() == &Context &&
147  "Expected module in same context");
148 
149  bool ret = TheLinker->linkInModule(Mod->takeModule());
151 
152  // We've just changed the input, so let's make sure we verify it.
153  HasVerifiedInput = false;
154 
155  return !ret;
156 }
157 
158 void LTOCodeGenerator::setModule(std::unique_ptr<LTOModule> Mod) {
159  assert(&Mod->getModule().getContext() == &Context &&
160  "Expected module in same context");
161 
162  AsmUndefinedRefs.clear();
163 
164  MergedModule = Mod->takeModule();
165  TheLinker = std::make_unique<Linker>(*MergedModule);
167 
168  // We've just changed the input, so let's make sure we verify it.
169  HasVerifiedInput = false;
170 }
171 
173  Config.Options = Options;
174 }
175 
177  switch (Debug) {
179  EmitDwarfDebugInfo = false;
180  return;
181 
183  EmitDwarfDebugInfo = true;
184  return;
185  }
186  llvm_unreachable("Unknown debug format!");
187 }
188 
190  Config.OptLevel = Level;
191  Config.PTO.LoopVectorization = Config.OptLevel > 1;
192  Config.PTO.SLPVectorization = Config.OptLevel > 1;
193  switch (Config.OptLevel) {
194  case 0:
195  Config.CGOptLevel = CodeGenOpt::None;
196  return;
197  case 1:
198  Config.CGOptLevel = CodeGenOpt::Less;
199  return;
200  case 2:
202  return;
203  case 3:
205  return;
206  }
207  llvm_unreachable("Unknown optimization level!");
208 }
209 
211  if (!determineTarget())
212  return false;
213 
214  // We always run the verifier once on the merged module.
215  verifyMergedModuleOnce();
216 
217  // mark which symbols can not be internalized
218  applyScopeRestrictions();
219 
220  // create output file
221  std::error_code EC;
222  ToolOutputFile Out(Path, EC, sys::fs::OF_None);
223  if (EC) {
224  std::string ErrMsg = "could not open bitcode file for writing: ";
225  ErrMsg += Path.str() + ": " + EC.message();
226  emitError(ErrMsg);
227  return false;
228  }
229 
230  // write bitcode to it
231  WriteBitcodeToFile(*MergedModule, Out.os(), ShouldEmbedUselists);
232  Out.os().close();
233 
234  if (Out.os().has_error()) {
235  std::string ErrMsg = "could not write bitcode file: ";
236  ErrMsg += Path.str() + ": " + Out.os().error().message();
237  emitError(ErrMsg);
238  Out.os().clear_error();
239  return false;
240  }
241 
242  Out.keep();
243  return true;
244 }
245 
246 bool LTOCodeGenerator::useAIXSystemAssembler() {
247  const auto &Triple = TargetMach->getTargetTriple();
248  return Triple.isOSAIX();
249 }
250 
251 bool LTOCodeGenerator::runAIXSystemAssembler(SmallString<128> &AssemblyFile) {
252  assert(useAIXSystemAssembler() &&
253  "Runing AIX system assembler when integrated assembler is available!");
254 
255  // Set the system assembler path.
256  std::string AssemblerPath(llvm::AIXSystemAssemblerPath.empty()
257  ? "/usr/bin/as"
259 
260  // Prepare inputs for the assember.
261  const auto &Triple = TargetMach->getTargetTriple();
262  const char *Arch = Triple.isArch64Bit() ? "-a64" : "-a32";
263  std::string ObjectFileName(AssemblyFile);
264  ObjectFileName[ObjectFileName.size() - 1] = 'o';
266  "/bin/env", "LDR_CNTRL=MAXDATA32=0x80000000@${LDR_CNTRL}",
267  AssemblerPath, Arch,
268  "-many", "-o",
269  ObjectFileName, AssemblyFile};
270 
271  // Invoke the assembler.
272  int RC = sys::ExecuteAndWait(Args[0], Args);
273 
274  // Handle errors.
275  if (RC < -1) {
276  emitError("LTO assembler exited abnormally");
277  return false;
278  }
279  if (RC < 0) {
280  emitError("Unable to invoke LTO assembler");
281  return false;
282  }
283  if (RC > 0) {
284  emitError("LTO assembler invocation returned non-zero");
285  return false;
286  }
287 
288  // Cleanup.
289  remove(AssemblyFile.c_str());
290 
291  // Fix the output file name.
292  AssemblyFile = ObjectFileName;
293 
294  return true;
295 }
296 
297 bool LTOCodeGenerator::compileOptimizedToFile(const char **Name) {
298  if (useAIXSystemAssembler())
300 
301  // make unique temp output file to put generated code
302  SmallString<128> Filename;
303 
304  auto AddStream = [&](size_t Task) -> std::unique_ptr<CachedFileStream> {
305  StringRef Extension(Config.CGFileType == CGFT_AssemblyFile ? "s" : "o");
306 
307  int FD;
308  std::error_code EC =
309  sys::fs::createTemporaryFile("lto-llvm", Extension, FD, Filename);
310  if (EC)
311  emitError(EC.message());
312 
313  return std::make_unique<CachedFileStream>(
314  std::make_unique<llvm::raw_fd_ostream>(FD, true));
315  };
316 
317  bool genResult = compileOptimized(AddStream, 1);
318 
319  if (!genResult) {
320  sys::fs::remove(Twine(Filename));
321  return false;
322  }
323 
324  // If statistics were requested, save them to the specified file or
325  // print them out after codegen.
326  if (StatsFile)
327  PrintStatisticsJSON(StatsFile->os());
328  else if (AreStatisticsEnabled())
329  PrintStatistics();
330 
331  if (useAIXSystemAssembler())
332  if (!runAIXSystemAssembler(Filename))
333  return false;
334 
335  NativeObjectPath = Filename.c_str();
336  *Name = NativeObjectPath.c_str();
337  return true;
338 }
339 
340 std::unique_ptr<MemoryBuffer>
342  const char *name;
343  if (!compileOptimizedToFile(&name))
344  return nullptr;
345 
346  // read .o file into memory buffer
348  name, /*IsText=*/false, /*RequiresNullTerminator=*/false);
349  if (std::error_code EC = BufferOrErr.getError()) {
350  emitError(EC.message());
351  sys::fs::remove(NativeObjectPath);
352  return nullptr;
353  }
354 
355  // remove temp files
356  sys::fs::remove(NativeObjectPath);
357 
358  return std::move(*BufferOrErr);
359 }
360 
362  if (!optimize())
363  return false;
364 
365  return compileOptimizedToFile(Name);
366 }
367 
368 std::unique_ptr<MemoryBuffer> LTOCodeGenerator::compile() {
369  if (!optimize())
370  return nullptr;
371 
372  return compileOptimized();
373 }
374 
375 bool LTOCodeGenerator::determineTarget() {
376  if (TargetMach)
377  return true;
378 
379  TripleStr = MergedModule->getTargetTriple();
380  if (TripleStr.empty()) {
381  TripleStr = sys::getDefaultTargetTriple();
382  MergedModule->setTargetTriple(TripleStr);
383  }
384  llvm::Triple Triple(TripleStr);
385 
386  // create target machine from info for merged modules
387  std::string ErrMsg;
388  MArch = TargetRegistry::lookupTarget(TripleStr, ErrMsg);
389  if (!MArch) {
390  emitError(ErrMsg);
391  return false;
392  }
393 
394  // Construct LTOModule, hand over ownership of module and target. Use MAttr as
395  // the default set of features.
396  SubtargetFeatures Features(join(Config.MAttrs, ""));
397  Features.getDefaultSubtargetFeatures(Triple);
398  FeatureStr = Features.getString();
399  // Set a default CPU for Darwin triples.
400  if (Config.CPU.empty() && Triple.isOSDarwin()) {
402  Config.CPU = "core2";
403  else if (Triple.getArch() == llvm::Triple::x86)
404  Config.CPU = "yonah";
405  else if (Triple.isArm64e())
406  Config.CPU = "apple-a12";
407  else if (Triple.getArch() == llvm::Triple::aarch64 ||
409  Config.CPU = "cyclone";
410  }
411 
412  // If data-sections is not explicitly set or unset, set data-sections by
413  // default to match the behaviour of lld and gold plugin.
415  Config.Options.DataSections = true;
416 
417  TargetMach = createTargetMachine();
418  assert(TargetMach && "Unable to create target machine");
419 
420  return true;
421 }
422 
423 std::unique_ptr<TargetMachine> LTOCodeGenerator::createTargetMachine() {
424  assert(MArch && "MArch is not set!");
425  return std::unique_ptr<TargetMachine>(MArch->createTargetMachine(
426  TripleStr, Config.CPU, FeatureStr, Config.Options, Config.RelocModel,
427  None, Config.CGOptLevel));
428 }
429 
430 // If a linkonce global is present in the MustPreserveSymbols, we need to make
431 // sure we honor this. To force the compiler to not drop it, we add it to the
432 // "llvm.compiler.used" global.
433 void LTOCodeGenerator::preserveDiscardableGVs(
434  Module &TheModule,
436  std::vector<GlobalValue *> Used;
437  auto mayPreserveGlobal = [&](GlobalValue &GV) {
438  if (!GV.isDiscardableIfUnused() || GV.isDeclaration() ||
439  !mustPreserveGV(GV))
440  return;
441  if (GV.hasAvailableExternallyLinkage())
442  return emitWarning(
443  (Twine("Linker asked to preserve available_externally global: '") +
444  GV.getName() + "'").str());
445  if (GV.hasInternalLinkage())
446  return emitWarning((Twine("Linker asked to preserve internal global: '") +
447  GV.getName() + "'").str());
448  Used.push_back(&GV);
449  };
450  for (auto &GV : TheModule)
451  mayPreserveGlobal(GV);
452  for (auto &GV : TheModule.globals())
453  mayPreserveGlobal(GV);
454  for (auto &GV : TheModule.aliases())
455  mayPreserveGlobal(GV);
456 
457  if (Used.empty())
458  return;
459 
460  appendToCompilerUsed(TheModule, Used);
461 }
462 
463 void LTOCodeGenerator::applyScopeRestrictions() {
464  if (ScopeRestrictionsDone)
465  return;
466 
467  // Declare a callback for the internalize pass that will ask for every
468  // candidate GlobalValue if it can be internalized or not.
469  Mangler Mang;
470  SmallString<64> MangledName;
471  auto mustPreserveGV = [&](const GlobalValue &GV) -> bool {
472  // Unnamed globals can't be mangled, but they can't be preserved either.
473  if (!GV.hasName())
474  return false;
475 
476  // Need to mangle the GV as the "MustPreserveSymbols" StringSet is filled
477  // with the linker supplied name, which on Darwin includes a leading
478  // underscore.
479  MangledName.clear();
480  MangledName.reserve(GV.getName().size() + 1);
481  Mang.getNameWithPrefix(MangledName, &GV, /*CannotUsePrivateLabel=*/false);
482  return MustPreserveSymbols.count(MangledName);
483  };
484 
485  // Preserve linkonce value on linker request
486  preserveDiscardableGVs(*MergedModule, mustPreserveGV);
487 
488  if (!ShouldInternalize)
489  return;
490 
491  if (ShouldRestoreGlobalsLinkage) {
492  // Record the linkage type of non-local symbols so they can be restored
493  // prior
494  // to module splitting.
495  auto RecordLinkage = [&](const GlobalValue &GV) {
496  if (!GV.hasAvailableExternallyLinkage() && !GV.hasLocalLinkage() &&
497  GV.hasName())
498  ExternalSymbols.insert(std::make_pair(GV.getName(), GV.getLinkage()));
499  };
500  for (auto &GV : *MergedModule)
501  RecordLinkage(GV);
502  for (auto &GV : MergedModule->globals())
503  RecordLinkage(GV);
504  for (auto &GV : MergedModule->aliases())
505  RecordLinkage(GV);
506  }
507 
508  // Update the llvm.compiler_used globals to force preserving libcalls and
509  // symbols referenced from asm
510  updateCompilerUsed(*MergedModule, *TargetMach, AsmUndefinedRefs);
511 
512  internalizeModule(*MergedModule, mustPreserveGV);
513 
514  ScopeRestrictionsDone = true;
515 }
516 
517 /// Restore original linkage for symbols that may have been internalized
518 void LTOCodeGenerator::restoreLinkageForExternals() {
519  if (!ShouldInternalize || !ShouldRestoreGlobalsLinkage)
520  return;
521 
522  assert(ScopeRestrictionsDone &&
523  "Cannot externalize without internalization!");
524 
525  if (ExternalSymbols.empty())
526  return;
527 
528  auto externalize = [this](GlobalValue &GV) {
529  if (!GV.hasLocalLinkage() || !GV.hasName())
530  return;
531 
532  auto I = ExternalSymbols.find(GV.getName());
533  if (I == ExternalSymbols.end())
534  return;
535 
536  GV.setLinkage(I->second);
537  };
538 
539  llvm::for_each(MergedModule->functions(), externalize);
540  llvm::for_each(MergedModule->globals(), externalize);
541  llvm::for_each(MergedModule->aliases(), externalize);
542 }
543 
544 void LTOCodeGenerator::verifyMergedModuleOnce() {
545  // Only run on the first call.
546  if (HasVerifiedInput)
547  return;
548  HasVerifiedInput = true;
549 
550  bool BrokenDebugInfo = false;
551  if (verifyModule(*MergedModule, &dbgs(), &BrokenDebugInfo))
552  report_fatal_error("Broken module found, compilation aborted!");
553  if (BrokenDebugInfo) {
554  emitWarning("Invalid debug info found, debug info will be stripped");
555  StripDebugInfo(*MergedModule);
556  }
557 }
558 
559 void LTOCodeGenerator::finishOptimizationRemarks() {
560  if (DiagnosticOutputFile) {
561  DiagnosticOutputFile->keep();
562  // FIXME: LTOCodeGenerator dtor is not invoked on Darwin
563  DiagnosticOutputFile->os().flush();
564  }
565 }
566 
567 /// Optimize merged modules using various IPO passes
569  if (!this->determineTarget())
570  return false;
571 
572  auto DiagFileOrErr = lto::setupLLVMOptimizationRemarks(
575  if (!DiagFileOrErr) {
576  errs() << "Error: " << toString(DiagFileOrErr.takeError()) << "\n";
577  report_fatal_error("Can't get an output file for the remarks");
578  }
579  DiagnosticOutputFile = std::move(*DiagFileOrErr);
580 
581  // Setup output file to emit statistics.
582  auto StatsFileOrErr = lto::setupStatsFile(LTOStatsFile);
583  if (!StatsFileOrErr) {
584  errs() << "Error: " << toString(StatsFileOrErr.takeError()) << "\n";
585  report_fatal_error("Can't get an output file for the statistics");
586  }
587  StatsFile = std::move(StatsFileOrErr.get());
588 
589  // Currently there is no support for enabling whole program visibility via a
590  // linker option in the old LTO API, but this call allows it to be specified
591  // via the internal option. Must be done before WPD invoked via the optimizer
592  // pipeline run below.
593  updatePublicTypeTestCalls(*MergedModule,
594  /* WholeProgramVisibilityEnabledInLTO */ false);
595  updateVCallVisibilityInModule(*MergedModule,
596  /* WholeProgramVisibilityEnabledInLTO */ false,
597  // FIXME: This needs linker information via a
598  // TBD new interface.
599  /* DynamicExportSymbols */ {});
600 
601  // We always run the verifier once on the merged module, the `DisableVerify`
602  // parameter only applies to subsequent verify.
603  verifyMergedModuleOnce();
604 
605  // Mark which symbols can not be internalized
606  this->applyScopeRestrictions();
607 
608  // Write LTOPostLink flag for passes that require all the modules.
609  MergedModule->addModuleFlag(Module::Error, "LTOPostLink", 1);
610 
611  // Add an appropriate DataLayout instance for this module...
612  MergedModule->setDataLayout(TargetMach->createDataLayout());
613 
614  if (!SaveIRBeforeOptPath.empty()) {
615  std::error_code EC;
616  raw_fd_ostream OS(SaveIRBeforeOptPath, EC, sys::fs::OF_None);
617  if (EC)
618  report_fatal_error(Twine("Failed to open ") + SaveIRBeforeOptPath +
619  " to save optimized bitcode\n");
620  WriteBitcodeToFile(*MergedModule, OS,
621  /* ShouldPreserveUseListOrder */ true);
622  }
623 
624  ModuleSummaryIndex CombinedIndex(false);
625  TargetMach = createTargetMachine();
626  if (!opt(Config, TargetMach.get(), 0, *MergedModule, /*IsThinLTO=*/false,
627  /*ExportSummary=*/&CombinedIndex, /*ImportSummary=*/nullptr,
628  /*CmdArgs*/ std::vector<uint8_t>())) {
629  emitError("LTO middle-end optimizations failed");
630  return false;
631  }
632 
633  return true;
634 }
635 
637  unsigned ParallelismLevel) {
638  if (!this->determineTarget())
639  return false;
640 
641  // We always run the verifier once on the merged module. If it has already
642  // been called in optimize(), this call will return early.
643  verifyMergedModuleOnce();
644 
645  // Re-externalize globals that may have been internalized to increase scope
646  // for splitting
647  restoreLinkageForExternals();
648 
649  ModuleSummaryIndex CombinedIndex(false);
650 
651  Config.CodeGenOnly = true;
652  Error Err = backend(Config, AddStream, ParallelismLevel, *MergedModule,
653  CombinedIndex);
654  assert(!Err && "unexpected code-generation failure");
655  (void)Err;
656 
657  // If statistics were requested, save them to the specified file or
658  // print them out after codegen.
659  if (StatsFile)
660  PrintStatisticsJSON(StatsFile->os());
661  else if (AreStatisticsEnabled())
662  PrintStatistics();
663 
665 
666  finishOptimizationRemarks();
667 
668  return true;
669 }
670 
672  for (StringRef Option : Options)
673  CodegenOptions.push_back(Option.str());
674 }
675 
677  if (!CodegenOptions.empty())
678  llvm::parseCommandLineOptions(CodegenOptions);
679 }
680 
681 void llvm::parseCommandLineOptions(std::vector<std::string> &Options) {
682  if (!Options.empty()) {
683  // ParseCommandLineOptions() expects argv[0] to be program name.
684  std::vector<const char *> CodegenArgv(1, "libLLVMLTO");
685  for (std::string &Arg : Options)
686  CodegenArgv.push_back(Arg.c_str());
687  cl::ParseCommandLineOptions(CodegenArgv.size(), CodegenArgv.data());
688  }
689 }
690 
692  // Map the LLVM internal diagnostic severity to the LTO diagnostic severity.
694  switch (DI.getSeverity()) {
695  case DS_Error:
696  Severity = LTO_DS_ERROR;
697  break;
698  case DS_Warning:
699  Severity = LTO_DS_WARNING;
700  break;
701  case DS_Remark:
702  Severity = LTO_DS_REMARK;
703  break;
704  case DS_Note:
705  Severity = LTO_DS_NOTE;
706  break;
707  }
708  // Create the string that will be reported to the external diagnostic handler.
709  std::string MsgStorage;
710  raw_string_ostream Stream(MsgStorage);
712  DI.print(DP);
713  Stream.flush();
714 
715  // If this method has been called it means someone has set up an external
716  // diagnostic handler. Assert on that.
717  assert(DiagHandler && "Invalid diagnostic handler");
718  (*DiagHandler)(Severity, MsgStorage.c_str(), DiagContext);
719 }
720 
721 namespace {
722 struct LTODiagnosticHandler : public DiagnosticHandler {
723  LTOCodeGenerator *CodeGenerator;
724  LTODiagnosticHandler(LTOCodeGenerator *CodeGenPtr)
725  : CodeGenerator(CodeGenPtr) {}
726  bool handleDiagnostics(const DiagnosticInfo &DI) override {
727  CodeGenerator->DiagnosticHandler(DI);
728  return true;
729  }
730 };
731 }
732 
733 void
735  void *Ctxt) {
736  this->DiagHandler = DiagHandler;
737  this->DiagContext = Ctxt;
738  if (!DiagHandler)
739  return Context.setDiagnosticHandler(nullptr);
740  // Register the LTOCodeGenerator stub in the LLVMContext to forward the
741  // diagnostic to the external DiagHandler.
742  Context.setDiagnosticHandler(std::make_unique<LTODiagnosticHandler>(this),
743  true);
744 }
745 
746 namespace {
747 class LTODiagnosticInfo : public DiagnosticInfo {
748  const Twine &Msg;
749 public:
750  LTODiagnosticInfo(const Twine &DiagMsg, DiagnosticSeverity Severity=DS_Error)
751  : DiagnosticInfo(DK_Linker, Severity), Msg(DiagMsg) {}
752  void print(DiagnosticPrinter &DP) const override { DP << Msg; }
753 };
754 }
755 
756 void LTOCodeGenerator::emitError(const std::string &ErrMsg) {
757  if (DiagHandler)
758  (*DiagHandler)(LTO_DS_ERROR, ErrMsg.c_str(), DiagContext);
759  else
760  Context.diagnose(LTODiagnosticInfo(ErrMsg));
761 }
762 
763 void LTOCodeGenerator::emitWarning(const std::string &ErrMsg) {
764  if (DiagHandler)
765  (*DiagHandler)(LTO_DS_WARNING, ErrMsg.c_str(), DiagContext);
766  else
767  Context.diagnose(LTODiagnosticInfo(ErrMsg, DS_Warning));
768 }
llvm::RemarksPasses
cl::opt< std::string > RemarksPasses("lto-pass-remarks-filter", cl::desc("Only record optimization remarks from passes whose " "names match the given regular expression"), cl::value_desc("regex"))
Definition: ThinLTOCodeGenerator.cpp:79
MemoryBuffer.h
llvm::LLVMContext::enableDebugTypeODRUniquing
void enableDebugTypeODRUniquing()
Definition: LLVMContext.cpp:342
lto_codegen_diagnostic_severity_t
lto_codegen_diagnostic_severity_t
Diagnostic severity.
Definition: lto.h:330
llvm::LTOCodeGenerator::setCodeGenDebugOptions
void setCodeGenDebugOptions(ArrayRef< StringRef > Opts)
Pass options to the driver and optimization passes.
Definition: LTOCodeGenerator.cpp:671
Signals.h
llvm::StripDebugInfo
bool StripDebugInfo(Module &M)
Strip debug info in the module if it exists.
Definition: DebugInfo.cpp:473
llvm::LTOCodeGenerator::setDiagnosticHandler
void setDiagnosticHandler(lto_diagnostic_handler_t, void *)
Definition: LTOCodeGenerator.cpp:734
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::reportAndResetTimings
void reportAndResetTimings(raw_ostream *OutStream=nullptr)
If -time-passes has been specified, report the timings immediately and then reset the timers to zero.
Definition: PassTimingInfo.cpp:162
llvm::raw_fd_ostream::close
void close()
Manually flush the stream and close the file.
Definition: raw_ostream.cpp:791
mustPreserveGV
static bool mustPreserveGV(const GlobalValue &GV)
Predicate for Internalize pass.
Definition: AMDGPUTargetMachine.cpp:569
FileSystem.h
llvm::sys::fs::OF_None
@ OF_None
Definition: FileSystem.h:757
llvm::ToolOutputFile
This class contains a raw_fd_ostream and adds a few extra features commonly needed for compiler-like ...
Definition: ToolOutputFile.h:26
LTO_DEBUG_MODEL_NONE
@ LTO_DEBUG_MODEL_NONE
Definition: lto.h:80
print
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
Definition: ArchiveWriter.cpp:189
llvm::LTOCodeGenerator::parseCodeGenDebugOptions
void parseCodeGenDebugOptions()
Parse the options set in setCodeGenDebugOptions.
Definition: LTOCodeGenerator.cpp:676
llvm::AIXSystemAssemblerPath
cl::opt< std::string > AIXSystemAssemblerPath("lto-aix-system-assembler", cl::desc("Absolute path to the system assembler, picked up on AIX only"), cl::value_desc("path"))
llvm::TargetOptions
Definition: TargetOptions.h:124
LTO_DS_NOTE
@ LTO_DS_NOTE
Definition: lto.h:334
LTO_DS_REMARK
@ LTO_DS_REMARK
Definition: lto.h:333
llvm::lto::Config::CGOptLevel
CodeGenOpt::Level CGOptLevel
Definition: Config.h:56
llvm::LTOStatsFile
cl::opt< std::string > LTOStatsFile("lto-stats-file", cl::desc("Save statistics to the specified file"), cl::Hidden)
llvm::DiagnosticPrinterRawOStream
Basic diagnostic printer that uses an underlying raw_ostream.
Definition: DiagnosticPrinter.h:61
llvm::lto::Config::CodeModel
Optional< CodeModel::Model > CodeModel
Definition: Config.h:55
llvm::Triple::x86
@ x86
Definition: Triple.h:85
llvm::raw_string_ostream
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:628
name
static const char * name
Definition: SMEABIPass.cpp:52
Host.h
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1181
llvm::codegen::getExplicitDataSections
Optional< bool > getExplicitDataSections()
Statistic.h
llvm::AddStreamFn
std::function< Expected< std::unique_ptr< CachedFileStream > >(unsigned Task)> AddStreamFn
This type defines the callback to add a file that is generated on the fly.
Definition: Caching.h:42
llvm::RemarksFilename
cl::opt< std::string > RemarksFilename("lto-pass-remarks-output", cl::desc("Output filename for pass remarks"), cl::value_desc("filename"))
Definition: ThinLTOCodeGenerator.cpp:78
llvm::LTOCodeGenerator::LTOCodeGenerator
LTOCodeGenerator(LLVMContext &Context)
Definition: LTOCodeGenerator.cpp:125
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
llvm::LTOCodeGenerator::setDebugInfo
void setDebugInfo(lto_debug_model)
Definition: LTOCodeGenerator.cpp:176
llvm::DiagnosticInfo::print
virtual void print(DiagnosticPrinter &DP) const =0
Print using the given DP a user-friendly message.
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:140
llvm::LTOCodeGenerator::setTargetOptions
void setTargetOptions(const TargetOptions &Options)
Definition: LTOCodeGenerator.cpp:172
externalize
static void externalize(GlobalValue *GV)
Definition: SplitModule.cpp:218
llvm::DK_Linker
@ DK_Linker
Definition: DiagnosticInfo.h:64
llvm::StringMap::end
iterator end()
Definition: StringMap.h:204
ParallelCG.h
llvm::ZeroCallUsedRegs::ZeroCallUsedRegsKind::Used
@ Used
Module.h
llvm::Triple::x86_64
@ x86_64
Definition: Triple.h:86
llvm::RemarksHotnessThreshold
cl::opt< Optional< uint64_t >, false, remarks::HotnessThresholdParser > RemarksHotnessThreshold("lto-pass-remarks-hotness-threshold", cl::desc("Minimum profile count required for an " "optimization remark to be output." " Use 'auto' to apply the threshold from profile summary."), cl::value_desc("uint or 'auto'"), cl::init(0), cl::Hidden)
Definition: ThinLTOCodeGenerator.cpp:82
llvm::DiagnosticHandler
This is the base class for diagnostic handling in LLVM.
Definition: DiagnosticHandler.h:24
llvm::ToolOutputFile::keep
void keep()
Indicate that the tool's job wrt this output file has been successful and the file should not be dele...
Definition: ToolOutputFile.h:67
UpdateCompilerUsed.h
ret
to esp esp setne al movzbw ax esp setg cl movzbw cx cmove cx cl jne LBB1_2 esp ret(also really horrible code on ppc). This is due to the expand code for 64-bit compares. GCC produces multiple branches
llvm::LTOCodeGenerator::compile_to_file
bool compile_to_file(const char **Name)
Compile the merged module into a single output file; the path to output file is returned to the calle...
Definition: LTOCodeGenerator.cpp:361
llvm::RemarksWithHotness
cl::opt< bool > RemarksWithHotness("lto-pass-remarks-with-hotness", cl::desc("With PGO, include profile count in optimization remarks"), cl::Hidden)
Definition: ThinLTOCodeGenerator.cpp:80
llvm::errs
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
Definition: raw_ostream.cpp:891
llvm::StringSet::insert
std::pair< typename Base::iterator, bool > insert(StringRef key)
Definition: StringSet.h:34
llvm::lto::setupLLVMOptimizationRemarks
Expected< std::unique_ptr< ToolOutputFile > > setupLLVMOptimizationRemarks(LLVMContext &Context, StringRef RemarksFilename, StringRef RemarksPasses, StringRef RemarksFormat, bool RemarksWithHotness, Optional< uint64_t > RemarksHotnessThreshold=0, int Count=-1)
Setup optimization remarks.
Definition: LTO.cpp:1610
llvm::StringMap::find
iterator find(StringRef Key)
Definition: StringMap.h:217
llvm::Mangler
Definition: Mangler.h:27
llvm::Triple::aarch64_32
@ aarch64_32
Definition: Triple.h:53
llvm::lto::Config::CodeGenOnly
bool CodeGenOnly
Disable entirely the optimizer, including importing for ThinLTO.
Definition: Config.h:69
llvm::LTOCodeGenerator::setOptLevel
void setOptLevel(unsigned OptLevel)
Definition: LTOCodeGenerator.cpp:189
llvm::TargetRegistry::lookupTarget
static const Target * lookupTarget(const std::string &Triple, std::string &Error)
lookupTarget - Lookup a target based on a target triple.
Definition: TargetRegistry.cpp:62
LTO_DS_WARNING
@ LTO_DS_WARNING
Definition: lto.h:332
LegacyPassManager.h
PassManagerBuilder.h
Internalize.h
endif
__FakeVCSRevision h endif() endif() set(generated_files "$
Definition: CMakeLists.txt:16
llvm::lto::setupStatsFile
Expected< std::unique_ptr< ToolOutputFile > > setupStatsFile(StringRef StatsFilename)
Setups the output file for saving statistics.
Definition: LTO.cpp:1635
new
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM ID Predecessors according to mbb< bb27, 0x8b0a7c0 > Note ADDri is not a two address instruction its result reg1037 is an operand of the PHI node in bb76 and its operand reg1039 is the result of the PHI node We should treat it as a two address code and make sure the ADDri is scheduled after any node that reads reg1039 Use info(i.e. register scavenger) to assign it a free register to allow reuse the collector could move the objects and invalidate the derived pointer This is bad enough in the first but safe points can crop up unpredictably **array_addr i32 n y store obj * new
Definition: README.txt:125
llvm::Triple::isArch64Bit
bool isArch64Bit() const
Test whether the architecture is 64-bit.
Definition: Triple.cpp:1451
llvm::LTOCodeGenerator::addModule
bool addModule(struct LTOModule *)
Merge given module.
Definition: LTOCodeGenerator.cpp:145
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163
Arg
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
Definition: AMDGPULibCalls.cpp:187
PassTimingInfo.h
CommandLine.h
llvm::MemoryBuffer::getFile
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFile(const Twine &Filename, bool IsText=false, bool RequiresNullTerminator=true, bool IsVolatile=false)
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful,...
Definition: MemoryBuffer.cpp:239
Process.h
llvm::AreStatisticsEnabled
bool AreStatisticsEnabled()
Check if statistics are enabled.
Definition: Statistic.cpp:139
llvm::LTOCodeGenerator::compile
std::unique_ptr< MemoryBuffer > compile()
As with compile_to_file(), this function compiles the merged module into single output file.
Definition: LTOCodeGenerator.cpp:368
SubtargetFeature.h
Constants.h
llvm::raw_fd_ostream::has_error
bool has_error() const
Return the value of the flag in this raw_fd_ostream indicating whether an output error has been encou...
Definition: raw_ostream.h:531
llvm::Triple::isOSDarwin
bool isOSDarwin() const
Is this a "Darwin" OS (macOS, iOS, tvOS, watchOS, or DriverKit).
Definition: Triple.h:509
llvm::DS_Warning
@ DS_Warning
Definition: DiagnosticInfo.h:51
Linker.h
BitcodeWriter.h
llvm::raw_fd_ostream::clear_error
void clear_error()
Set the flag read by has_error() to false.
Definition: raw_ostream.h:542
llvm::LTODiscardValueNames
cl::opt< bool > LTODiscardValueNames("lto-discard-value-names", cl::desc("Strip names from Value during LTO (other than GlobalValue)."), cl::init(false), cl::Hidden)
Definition: ThinLTOCodeGenerator.cpp:77
llvm::StringMap::insert
bool insert(MapEntryTy *KeyValue)
insert - Insert the specified key/value pair into the map.
Definition: StringMap.h:275
MCContext.h
llvm::lto::Config::Options
TargetOptions Options
Definition: Config.h:48
llvm::lto::Config::PreCodeGenPassesHook
std::function< void(legacy::PassManager &)> PreCodeGenPassesHook
For adding passes that run right before codegen.
Definition: Config.h:53
llvm::cl::ParseCommandLineOptions
bool ParseCommandLineOptions(int argc, const char *const *argv, StringRef Overview="", raw_ostream *Errs=nullptr, const char *EnvVar=nullptr, bool LongOptionsUseDoubleDash=false)
Definition: CommandLine.cpp:1373
llvm::SubtargetFeatures
Manages the enabling and disabling of subtarget specific features.
Definition: SubtargetFeature.h:180
HotnessThresholdParser.h
TargetLibraryInfo.h
llvm::ErrorOr::getError
std::error_code getError() const
Definition: ErrorOr.h:153
llvm::Mangler::getNameWithPrefix
void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV, bool CannotUsePrivateLabel) const
Print the appropriate prefix and the specified global variable's name.
Definition: Mangler.cpp:119
llvm::LTOCodeGenerator::compileOptimized
std::unique_ptr< MemoryBuffer > compileOptimized()
Compiles the merged optimized module into a single output file.
Definition: LTOCodeGenerator.cpp:341
opt
arm prera ldst opt
Definition: ARMLoadStoreOptimizer.cpp:2191
llvm::DiagnosticSeverity
DiagnosticSeverity
Defines the different supported severity of a diagnostic.
Definition: DiagnosticInfo.h:49
LTOModule.h
llvm::StringMap::clear
void clear()
Definition: StringMap.h:348
llvm::appendToCompilerUsed
void appendToCompilerUsed(Module &M, ArrayRef< GlobalValue * > Values)
Adds global values to the llvm.compiler.used list.
Definition: ModuleUtils.cpp:109
llvm::report_fatal_error
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:145
Options
const char LLVMTargetMachineRef LLVMPassBuilderOptionsRef Options
Definition: PassBuilderBindings.cpp:48
llvm::raw_ostream::flush
void flush()
Definition: raw_ostream.h:185
llvm::DiagnosticInfo::getSeverity
DiagnosticSeverity getSeverity() const
Definition: DiagnosticInfo.h:123
llvm::LTOCodeGenerator::optimize
bool optimize()
Optimizes the merged module.
Definition: LTOCodeGenerator.cpp:568
llvm::DiagnosticInfo
This is the base abstract class for diagnostic reporting in the backend.
Definition: DiagnosticInfo.h:108
llvm::DiagnosticPrinter
Interface for custom diagnostic printing.
Definition: DiagnosticPrinter.h:31
llvm::LLVMContext::setDiagnosticHandler
void setDiagnosticHandler(std::unique_ptr< DiagnosticHandler > &&DH, bool RespectFilters=false)
setDiagnosticHandler - This method sets unique_ptr to object of DiagnosticHandler to provide custom d...
Definition: LLVMContext.cpp:130
llvm::Triple::isOSAIX
bool isOSAIX() const
Tests whether the OS is AIX.
Definition: Triple.h:658
llvm::Triple::getArch
ArchType getArch() const
Get the parsed architecture type of this triple.
Definition: Triple.h:346
llvm::None
const NoneType None
Definition: None.h:24
llvm::lto::Config::StatsFile
std::string StatsFile
Statistics output file path.
Definition: Config.h:164
lto_debug_model
lto_debug_model
Definition: lto.h:79
llvm::SmallString< 128 >
llvm::RemarksFormat
cl::opt< std::string > RemarksFormat("lto-pass-remarks-format", cl::desc("The format used for serializing remarks (default: YAML)"), cl::value_desc("format"), cl::init("yaml"))
Definition: ThinLTOCodeGenerator.cpp:83
LTOBackend.h
llvm::lto::Config::OptLevel
unsigned OptLevel
Definition: Config.h:58
llvm::LTOCodeGenerator::DiagnosticHandler
void DiagnosticHandler(const DiagnosticInfo &DI)
Definition: LTOCodeGenerator.cpp:691
llvm::function_ref
An efficient, type-erasing, non-owning reference to a callable.
Definition: STLFunctionalExtras.h:36
llvm::LTOCodeGenerator::getVersionString
static const char * getVersionString()
Definition: LTOCodeGenerator.cpp:70
llvm::cl::opt< bool >
llvm::SmallString::c_str
const char * c_str()
Definition: SmallString.h:263
llvm::PrintStatisticsJSON
void PrintStatisticsJSON(raw_ostream &OS)
Print statistics in JSON format.
Definition: Statistic.cpp:203
llvm::lto::backend
Error backend(const Config &C, AddStreamFn AddStream, unsigned ParallelCodeGenParallelismLevel, Module &M, ModuleSummaryIndex &CombinedIndex)
Runs a regular LTO backend.
Definition: LTOBackend.cpp:493
llvm::parseCommandLineOptions
void parseCommandLineOptions(std::vector< std::string > &Options)
A convenience function that calls cl::ParseCommandLineOptions on the given set of options.
Definition: LTOCodeGenerator.cpp:681
llvm::GlobalValue
Definition: GlobalValue.h:44
llvm::CodeGenOpt::Default
@ Default
Definition: CodeGen.h:55
llvm::RegState::Undef
@ Undef
Value of the register doesn't matter.
Definition: MachineInstrBuilder.h:52
llvm::LTOCodeGenerator::~LTOCodeGenerator
~LTOCodeGenerator()
llvm::for_each
UnaryFunction for_each(R &&Range, UnaryFunction F)
Provide wrappers to std::for_each which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1583
llvm::DS_Remark
@ DS_Remark
Definition: DiagnosticInfo.h:52
llvm::remarks::HotnessThresholdParser
Definition: HotnessThresholdParser.h:45
IPO.h
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:67
DebugInfo.h
llvm::LTOCodeGenerator
C++ class which implements the opaque lto_code_gen_t type.
Definition: LTOCodeGenerator.h:72
I
#define I(x, y, z)
Definition: MD5.cpp:58
StringExtras.h
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:440
llvm::LTOCodeGenerator::setFileType
void setFileType(CodeGenFileType FT)
Set the file type to be emitted (assembly or object code).
Definition: LTOCodeGenerator.h:97
ToolOutputFile.h
LTO_DS_ERROR
@ LTO_DS_ERROR
Definition: lto.h:331
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::PipelineTuningOptions::SLPVectorization
bool SLPVectorization
Tuning option to enable/disable slp loop vectorization, set based on opt level.
Definition: PassBuilder.h:53
lto_diagnostic_handler_t
void(* lto_diagnostic_handler_t)(lto_codegen_diagnostic_severity_t severity, const char *diag, void *ctxt)
Diagnostic handler type.
Definition: lto.h:346
llvm::codeview::CompileSym2Flags::EC
@ EC
PreferPredicateTy::Option
Option
Definition: LoopVectorize.cpp:211
llvm::lto::Config::MAttrs
std::vector< std::string > MAttrs
Definition: Config.h:49
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
NDEBUG
#define NDEBUG
Definition: regutils.h:48
llvm::updateCompilerUsed
void updateCompilerUsed(Module &TheModule, const TargetMachine &TM, const StringSet<> &AsmUndefinedRefs)
Find all globals in TheModule that are referenced in AsmUndefinedRefs, as well as the user-supplied f...
Definition: UpdateCompilerUsed.cpp:123
llvm::CodeGenOpt::Aggressive
@ Aggressive
Definition: CodeGen.h:56
llvm::PrintStatistics
void PrintStatistics()
Print statistics to the file returned by CreateInfoOutputFile().
Definition: Statistic.cpp:229
llvm::Linker
This class provides the core functionality of linking in LLVM.
Definition: Linker.h:22
llvm::internalizeModule
bool internalizeModule(Module &TheModule, std::function< bool(const GlobalValue &)> MustPreserveGV, CallGraph *CG=nullptr)
Helper function to internalize functions and variables in a Module.
Definition: Internalize.h:79
Mangler.h
YAMLTraits.h
llvm::CodeGenOpt::None
@ None
Definition: CodeGen.h:53
llvm::WriteBitcodeToFile
void WriteBitcodeToFile(const Module &M, raw_ostream &Out, bool ShouldPreserveUseListOrder=false, const ModuleSummaryIndex *Index=nullptr, bool GenerateHash=false, ModuleHash *ModHash=nullptr)
Write the specified module to the specified raw output stream.
Definition: BitcodeWriter.cpp:4691
llvm::sys::fs::remove
std::error_code remove(const Twine &path, bool IgnoreNonExisting=true)
Remove path.
TargetOptions.h
llvm::raw_fd_ostream::error
std::error_code error() const
Definition: raw_ostream.h:525
llvm::sys::fs::createTemporaryFile
std::error_code createTemporaryFile(const Twine &Prefix, StringRef Suffix, int &ResultFD, SmallVectorImpl< char > &ResultPath, OpenFlags Flags=OF_None)
Create a file in the system temporary directory.
Definition: Path.cpp:863
llvm::sys::getDefaultTargetTriple
std::string getDefaultTargetTriple()
getDefaultTargetTriple() - Return the default target triple the compiler has been configured to produ...
llvm::LTOCodeGenerator::setModule
void setModule(std::unique_ptr< LTOModule > M)
Set the destination module.
Definition: LTOCodeGenerator.cpp:158
llvm::lto::Config::RelocModel
Optional< Reloc::Model > RelocModel
Definition: Config.h:54
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::updateVCallVisibilityInModule
void updateVCallVisibilityInModule(Module &M, bool WholeProgramVisibilityEnabledInLTO, const DenseSet< GlobalValue::GUID > &DynamicExportSymbols)
If whole program visibility asserted, then upgrade all public vcall visibility metadata on vtable def...
Definition: WholeProgramDevirt.cpp:787
DiagHandler
static void DiagHandler(const SMDiagnostic &Diag, void *Context)
Definition: TextStub.cpp:1094
MCAsmInfo.h
DataLayout.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
DP
So we should use XX3Form_Rcr to implement intrinsic Convert DP outs ins xscvdpsp No builtin are required Round &Convert QP DP(dword[1] is set to zero) No builtin are required Round to Quad Precision because you need to assign rounding mode in instruction Provide builtin(set f128:$vT,(int_ppc_vsx_xsrqpi f128:$vB))(set f128 yields< n x< ty > >< result > yields< ty >< result > No builtin are required Load Store load store see def memrix16 in PPCInstrInfo td Load Store Vector load store outs ins lxsdx set load store with conversion from to DP
Definition: README_P9.txt:520
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:143
TargetSubtargetInfo.h
llvm::PipelineTuningOptions::LoopVectorization
bool LoopVectorization
Tuning option to enable/disable loop vectorization, set based on opt level.
Definition: PassBuilder.h:49
llvm::PICLevel::Level
Level
Definition: CodeGen.h:33
llvm::Module::Error
@ Error
Emits an error if two values disagree, otherwise the resulting value is that of the operands.
Definition: Module.h:118
llvm::raw_fd_ostream
A raw_ostream that writes to a file descriptor.
Definition: raw_ostream.h:440
llvm::AMDGPU::SendMsg::Msg
const CustomOperand< const MCSubtargetInfo & > Msg[]
Definition: AMDGPUAsmUtils.cpp:39
llvm::msgpack::Type::Extension
@ Extension
llvm::LTOCodeGenerator::writeMergedModules
bool writeMergedModules(StringRef Path)
Write the merged module to the file specified by the given path.
Definition: LTOCodeGenerator.cpp:210
llvm::LLVMContext::diagnose
void diagnose(const DiagnosticInfo &DI)
Report a message to the currently installed diagnostic handler.
Definition: LLVMContext.cpp:248
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
Verifier.h
llvm::empty
constexpr bool empty(const T &RangeOrContainer)
Test whether RangeOrContainer is empty. Similar to C++17 std::empty.
Definition: STLExtras.h:256
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:50
LLVMRemarkStreamer.h
llvm::toString
const char * toString(DWARFSectionKind Kind)
Definition: DWARFUnitIndex.h:67
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:155
llvm::legacy::PassManager
PassManager manages ModulePassManagers.
Definition: LegacyPassManager.h:52
llvm::c_str
SmallVectorImpl< T >::const_pointer c_str(SmallVectorImpl< T > &str)
Definition: WindowsSupport.h:193
llvm::ToolOutputFile::os
raw_fd_ostream & os()
Return the contained raw_fd_ostream.
Definition: ToolOutputFile.h:60
llvm::Module::getContext
LLVMContext & getContext() const
Get the global data context.
Definition: Module.h:262
DiagnosticInfo.h
llvm::Triple::isArm64e
bool isArm64e() const
Tests whether the target is the Apple "arm64e" AArch64 subarch.
Definition: Triple.h:920
llvm::TargetOptions::DataSections
unsigned DataSections
Emit data into separate sections.
Definition: TargetOptions.h:266
llvm::LLVMContext::setDiscardValueNames
void setDiscardValueNames(bool Discard)
Set the Context runtime configuration to discard all value name (but GlobalValue).
Definition: LLVMContext.cpp:351
llvm::cl::value_desc
Definition: CommandLine.h:422
llvm::lto::Config::PTO
PipelineTuningOptions PTO
Tunable parameters for passes in the default pipelines.
Definition: Config.h:192
llvm::SmallVectorImpl::clear
void clear()
Definition: SmallVector.h:596
llvm::StringMap::count
size_type count(StringRef Key) const
count - Return 1 if the element is in the map, 0 otherwise.
Definition: StringMap.h:245
LTO_DEBUG_MODEL_DWARF
@ LTO_DEBUG_MODEL_DWARF
Definition: lto.h:81
WholeProgramDevirt.h
llvm::lto::Config::CGFileType
CodeGenFileType CGFileType
Definition: Config.h:57
llvm::StringMapImpl::empty
bool empty() const
Definition: StringMap.h:94
llvm::updatePublicTypeTestCalls
void updatePublicTypeTestCalls(Module &M, bool WholeProgramVisibilityEnabledInLTO)
Definition: WholeProgramDevirt.cpp:805
ObjCARC.h
LTO.h
llvm::ModuleSummaryIndex
Class to hold module path string table and global value map, and encapsulate methods for operating on...
Definition: ModuleSummaryIndex.h:1087
ModuleUtils.h
llvm::sys::ExecuteAndWait
int ExecuteAndWait(StringRef Program, ArrayRef< StringRef > Args, Optional< ArrayRef< StringRef >> Env=None, ArrayRef< Optional< StringRef >> Redirects={}, unsigned SecondsToWait=0, unsigned MemoryLimit=0, std::string *ErrMsg=nullptr, bool *ExecutionFailed=nullptr, Optional< ProcessStatistics > *ProcStat=nullptr, BitVector *AffinityMask=nullptr)
This function executes the program using the arguments provided.
Definition: Program.cpp:31
llvm::ErrorOr
Represents either an error or a value T.
Definition: ErrorOr.h:56
TargetTransformInfo.h
DerivedTypes.h
TargetSelect.h
llvm::lto::Config::CPU
std::string CPU
Definition: Config.h:47
LLVMContext.h
llvm::LTOCodeGenerator::setAsmUndefinedRefs
void setAsmUndefinedRefs(struct LTOModule *)
Definition: LTOCodeGenerator.cpp:140
llvm::createObjCARCContractPass
Pass * createObjCARCContractPass()
Definition: ObjCARCContract.cpp:733
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition: AMDGPUMetadata.h:394
llvm::cl::desc
Definition: CommandLine.h:413
Mod
Module * Mod
Definition: PassBuilderBindings.cpp:54
llvm::CGFT_AssemblyFile
@ CGFT_AssemblyFile
Definition: CodeGen.h:64
raw_ostream.h
llvm::CodeGenOpt::Less
@ Less
Definition: CodeGen.h:54
llvm::SmallVectorImpl::reserve
void reserve(size_type N)
Definition: SmallVector.h:649
DiagnosticPrinter.h
TargetRegistry.h
InitializePasses.h
llvm::LTOModule
C++ class which implements the opaque lto_module_t type.
Definition: LTOModule.h:38
CommandFlags.h
llvm::DS_Error
@ DS_Error
Definition: DiagnosticInfo.h:50
llvm::Triple::aarch64
@ aarch64
Definition: Triple.h:51
llvm::verifyModule
bool verifyModule(const Module &M, raw_ostream *OS=nullptr, bool *BrokenDebugInfo=nullptr)
Check a module for errors.
Definition: Verifier.cpp:6280
Passes.h
llvm::Target::createTargetMachine
TargetMachine * createTargetMachine(StringRef TT, StringRef CPU, StringRef Features, const TargetOptions &Options, Optional< Reloc::Model > RM, Optional< CodeModel::Model > CM=None, CodeGenOpt::Level OL=CodeGenOpt::Default, bool JIT=false) const
createTargetMachine - Create a target specific machine implementation for the specified Triple.
Definition: TargetRegistry.h:469
llvm::DS_Note
@ DS_Note
Definition: DiagnosticInfo.h:55
LTOCodeGenerator.h