clang 8.0.0

Functions
BackendUtil.cpp File Reference
`#include "clang/CodeGen/BackendUtil.h"`
`#include "clang/Basic/CodeGenOptions.h"`
`#include "clang/Basic/Diagnostic.h"`
`#include "clang/Basic/LangOptions.h"`
`#include "clang/Basic/TargetOptions.h"`
`#include "clang/Frontend/FrontendDiagnostic.h"`
`#include "clang/Frontend/Utils.h"`
`#include "clang/Lex/HeaderSearchOptions.h"`
`#include "llvm/ADT/SmallSet.h"`
`#include "llvm/ADT/StringExtras.h"`
`#include "llvm/ADT/StringSwitch.h"`
`#include "llvm/ADT/Triple.h"`
`#include "llvm/Analysis/TargetLibraryInfo.h"`
`#include "llvm/Analysis/TargetTransformInfo.h"`
`#include "llvm/Bitcode/BitcodeReader.h"`
`#include "llvm/Bitcode/BitcodeWriter.h"`
`#include "llvm/Bitcode/BitcodeWriterPass.h"`
`#include "llvm/CodeGen/RegAllocRegistry.h"`
`#include "llvm/CodeGen/SchedulerRegistry.h"`
`#include "llvm/CodeGen/TargetSubtargetInfo.h"`
`#include "llvm/IR/DataLayout.h"`
`#include "llvm/IR/IRPrintingPasses.h"`
`#include "llvm/IR/LegacyPassManager.h"`
`#include "llvm/IR/Module.h"`
`#include "llvm/IR/ModuleSummaryIndex.h"`
`#include "llvm/IR/Verifier.h"`
`#include "llvm/LTO/LTOBackend.h"`
`#include "llvm/MC/MCAsmInfo.h"`
`#include "llvm/MC/SubtargetFeature.h"`
`#include "llvm/Passes/PassBuilder.h"`
`#include "llvm/Support/BuryPointer.h"`
`#include "llvm/Support/CommandLine.h"`
`#include "llvm/Support/MemoryBuffer.h"`
`#include "llvm/Support/PrettyStackTrace.h"`
`#include "llvm/Support/TargetRegistry.h"`
`#include "llvm/Support/Timer.h"`
`#include "llvm/Support/raw_ostream.h"`
`#include "llvm/Target/TargetMachine.h"`
`#include "llvm/Target/TargetOptions.h"`
`#include "llvm/Transforms/Coroutines.h"`
`#include "llvm/Transforms/IPO.h"`
`#include "llvm/Transforms/IPO/AlwaysInliner.h"`
`#include "llvm/Transforms/IPO/PassManagerBuilder.h"`
`#include "llvm/Transforms/IPO/ThinLTOBitcodeWriter.h"`
`#include "llvm/Transforms/InstCombine/InstCombine.h"`
`#include "llvm/Transforms/Instrumentation.h"`
`#include "llvm/Transforms/Instrumentation/BoundsChecking.h"`
`#include "llvm/Transforms/Instrumentation/GCOVProfiler.h"`
`#include "llvm/Transforms/Instrumentation/MemorySanitizer.h"`
`#include "llvm/Transforms/Instrumentation/ThreadSanitizer.h"`
`#include "llvm/Transforms/ObjCARC.h"`
`#include "llvm/Transforms/Scalar.h"`
`#include "llvm/Transforms/Scalar/GVN.h"`
`#include "llvm/Transforms/Utils.h"`
`#include "llvm/Transforms/Utils/CanonicalizeAliases.h"`
`#include "llvm/Transforms/Utils/NameAnonGlobals.h"`
`#include "llvm/Transforms/Utils/SymbolRewriter.h"`
`#include <memory>`

Go to the source code of this file.

## Functions
static void | addObjCARCAPElimPass (const PassManagerBuilder &Builder, PassManagerBase &PM)
static void | addObjCARCExpandPass (const PassManagerBuilder &Builder, PassManagerBase &PM)
static void | addObjCARCOptPass (const PassManagerBuilder &Builder, PassManagerBase &PM)
static void | addAddDiscriminatorsPass (const PassManagerBuilder &Builder, legacy::PassManagerBase &PM)
static void | addBoundsCheckingPass (const PassManagerBuilder &Builder, legacy::PassManagerBase &PM)
static void | addSanitizerCoveragePass (const PassManagerBuilder &Builder, legacy::PassManagerBase &PM)
static bool | asanUseGlobalsGC (const Triple &T, const CodeGenOptions &CGOpts)
static void | addAddressSanitizerPasses (const PassManagerBuilder &Builder, legacy::PassManagerBase &PM)
static void | addKernelAddressSanitizerPasses (const PassManagerBuilder &Builder, legacy::PassManagerBase &PM)
static void | addHWAddressSanitizerPasses (const PassManagerBuilder &Builder, legacy::PassManagerBase &PM)
static void | addKernelHWAddressSanitizerPasses (const PassManagerBuilder &Builder, legacy::PassManagerBase &PM)
static void | addGeneralOptsForMemorySanitizer (const PassManagerBuilder &Builder, legacy::PassManagerBase &PM, bool CompileKernel)
static void | addMemorySanitizerPass (const PassManagerBuilder &Builder, legacy::PassManagerBase &PM)
static void | addKernelMemorySanitizerPass (const PassManagerBuilder &Builder, legacy::PassManagerBase &PM)
static void | addThreadSanitizerPass (const PassManagerBuilder &Builder, legacy::PassManagerBase &PM)
static void | addDataFlowSanitizerPass (const PassManagerBuilder &Builder, legacy::PassManagerBase &PM)
static void | addEfficiencySanitizerPass (const PassManagerBuilder &Builder, legacy::PassManagerBase &PM)
static TargetLibraryInfoImpl * | createTLII (llvm::Triple &TargetTriple, const CodeGenOptions &CodeGenOpts)
static void | addSymbolRewriterPass (const CodeGenOptions &Opts, legacy::PassManager *MPM)
static CodeGenOpt::Level | getCGOptLevel (const CodeGenOptions &CodeGenOpts)
static Optional< llvm::CodeModel::Model > | getCodeModel (const CodeGenOptions &CodeGenOpts)
static TargetMachine::CodeGenFileType | getCodeGenFileType (BackendAction Action)
static void | initTargetOptions (llvm::TargetOptions &Options, const CodeGenOptions &CodeGenOpts, const clang::TargetOptions &TargetOpts, const LangOptions &LangOpts, const HeaderSearchOptions &HSOpts)
static Optional< GCOVOptions > | getGCOVOptions (const CodeGenOptions &CodeGenOpts)
static void | setCommandLineOpts (const CodeGenOptions &CodeGenOpts)
static PassBuilder::OptimizationLevel | mapToLevel (const CodeGenOptions &Opts)
static void | runThinLTOBackend (ModuleSummaryIndex *CombinedIndex, Module *M, const HeaderSearchOptions &HeaderOpts, const CodeGenOptions &CGOpts, const clang::TargetOptions &TOpts, const LangOptions &LOpts, std::unique_ptr< raw_pwrite_stream > OS, std::string SampleProfile, std::string ProfileRemapping, BackendAction Action)
static const char * | getSectionNameForBitcode (const Triple &T)
static const char * | getSectionNameForCommandline (const Triple &T)

## Function Documentation

## ◆ addAddDiscriminatorsPass()

static void addAddDiscriminatorsPass | ( | const PassManagerBuilder & | Builder,
|  | legacy::PassManagerBase & | PM
| ) |  |
| static

Definition at line 183 of file BackendUtil.cpp.

## ◆ addAddressSanitizerPasses()

static void addAddressSanitizerPasses | ( | const PassManagerBuilder & | Builder,
|  | legacy::PassManagerBase & | PM
| ) |  |
| static

Definition at line 234 of file BackendUtil.cpp.

## ◆ addBoundsCheckingPass()

static void addBoundsCheckingPass | ( | const PassManagerBuilder & | Builder,
|  | legacy::PassManagerBase & | PM
| ) |  |
| static

Definition at line 188 of file BackendUtil.cpp.

## ◆ addDataFlowSanitizerPass()

static void addDataFlowSanitizerPass | ( | const PassManagerBuilder & | Builder,
|  | legacy::PassManagerBase & | PM
| ) |  |
| static

Definition at line 312 of file BackendUtil.cpp.

## ◆ addEfficiencySanitizerPass()

static void addEfficiencySanitizerPass | ( | const PassManagerBuilder & | Builder,
|  | legacy::PassManagerBase & | PM
| ) |  |
| static

Definition at line 320 of file BackendUtil.cpp.

## ◆ addGeneralOptsForMemorySanitizer()

static void addGeneralOptsForMemorySanitizer | ( | const PassManagerBuilder & | Builder,
|  | legacy::PassManagerBase & | PM,
|  | bool | CompileKernel
| ) |  |
| static

Definition at line 274 of file BackendUtil.cpp.

## ◆ addHWAddressSanitizerPasses()

static void addHWAddressSanitizerPasses | ( | const PassManagerBuilder & | Builder,
|  | legacy::PassManagerBase & | PM
| ) |  |
| static

Definition at line 259 of file BackendUtil.cpp.

## ◆ addKernelAddressSanitizerPasses()

static void addKernelAddressSanitizerPasses | ( | const PassManagerBuilder & | Builder,
|  | legacy::PassManagerBase & | PM
| ) |  |
| static

Definition at line 250 of file BackendUtil.cpp.

## ◆ addKernelHWAddressSanitizerPasses()

static void addKernelHWAddressSanitizerPasses | ( | const PassManagerBuilder & | Builder,
|  | legacy::PassManagerBase & | PM
| ) |  |
| static

Definition at line 268 of file BackendUtil.cpp.

## ◆ addKernelMemorySanitizerPass()

static void addKernelMemorySanitizerPass | ( | const PassManagerBuilder & | Builder,
|  | legacy::PassManagerBase & | PM
| ) |  |
| static

Definition at line 302 of file BackendUtil.cpp.

## ◆ addMemorySanitizerPass()

static void addMemorySanitizerPass | ( | const PassManagerBuilder & | Builder,
|  | legacy::PassManagerBase & | PM
| ) |  |
| static

Definition at line 297 of file BackendUtil.cpp.

## ◆ addObjCARCAPElimPass()

static void addObjCARCAPElimPass | ( | const PassManagerBuilder & | Builder,
|  | PassManagerBase & | PM
| ) |  |
| static

Definition at line 168 of file BackendUtil.cpp.

## ◆ addObjCARCExpandPass()

static void addObjCARCExpandPass | ( | const PassManagerBuilder & | Builder,
|  | PassManagerBase & | PM
| ) |  |
| static

Definition at line 173 of file BackendUtil.cpp.

## ◆ addObjCARCOptPass()

static void addObjCARCOptPass | ( | const PassManagerBuilder & | Builder,
|  | PassManagerBase & | PM
| ) |  |
| static

Definition at line 178 of file BackendUtil.cpp.

## ◆ addSanitizerCoveragePass()

static void addSanitizerCoveragePass | ( | const PassManagerBuilder & | Builder,
|  | legacy::PassManagerBase & | PM
| ) |  |
| static

Definition at line 193 of file BackendUtil.cpp.

## ◆ addSymbolRewriterPass()

static void addSymbolRewriterPass | ( | const CodeGenOptions & | Opts,
|  | legacy::PassManager * | MPM
| ) |  |
| static

Definition at line 359 of file BackendUtil.cpp.

References clang::CodeGenOptions::RewriteMapFiles.

## ◆ addThreadSanitizerPass()

static void addThreadSanitizerPass | ( | const PassManagerBuilder & | Builder,
|  | legacy::PassManagerBase & | PM
| ) |  |
| static

Definition at line 307 of file BackendUtil.cpp.

## ◆ asanUseGlobalsGC()

static bool asanUseGlobalsGC | ( | const Triple & | T,
|  | const CodeGenOptions & | CGOpts
| ) |  |
| static

Definition at line 220 of file BackendUtil.cpp.

## ◆ createTLII()

static TargetLibraryInfoImpl* createTLII | ( | llvm::Triple & | TargetTriple,
|  | const CodeGenOptions & | CodeGenOpts
| ) |  |
| static

Definition at line 333 of file BackendUtil.cpp.

References clang::CodeGenOptions::Accelerate, clang::CodeGenOptions::getNoBuiltinFuncs(), and clang::CodeGenOptions::SVML.

Referenced by mapToLevel().

## ◆ getCGOptLevel()

static CodeGenOpt::Level getCGOptLevel | ( | const CodeGenOptions & | CodeGenOpts | ) |
| static

Definition at line 370 of file BackendUtil.cpp.

References clang::Default, clang::Less, and clang::None.

Referenced by runThinLTOBackend(), and setCommandLineOpts().

## ◆ getCodeGenFileType()

static TargetMachine::CodeGenFileType getCodeGenFileType | ( | BackendAction | Action | ) |
| static

Definition at line 401 of file BackendUtil.cpp.

References clang::Backend_EmitAssembly, clang::Backend_EmitMCNull, and clang::Backend_EmitObj.

Referenced by runThinLTOBackend().

## ◆ getCodeModel()

static Optional<llvm::CodeModel::Model> getCodeModel | ( | const CodeGenOptions & | CodeGenOpts | ) |
| static

Definition at line 386 of file BackendUtil.cpp.

References clang::CodeGenOptions::CodeModel, and clang::None.

Referenced by runThinLTOBackend(), and setCommandLineOpts().

## ◆ getGCOVOptions()

static Optional<GCOVOptions> getGCOVOptions | ( | const CodeGenOptions & | CodeGenOpts | ) |
| static

Definition at line 498 of file BackendUtil.cpp.

References clang::None.

## ◆ getSectionNameForBitcode()

static const char* getSectionNameForBitcode | ( | const Triple & | T | ) |
| static

Definition at line 1333 of file BackendUtil.cpp.

Referenced by clang::EmbedBitcode().

## ◆ getSectionNameForCommandline()

static const char* getSectionNameForCommandline | ( | const Triple & | T | ) |
| static

Definition at line 1346 of file BackendUtil.cpp.

Referenced by clang::EmbedBitcode().

## ◆ initTargetOptions()

static void initTargetOptions | ( | llvm::TargetOptions & | Options,
|  | const CodeGenOptions & | CodeGenOpts,
|  | const clang::TargetOptions & | TargetOpts,
|  | const LangOptions & | LangOpts,
|  | const HeaderSearchOptions & | HSOpts
| ) |  |
| static

Definition at line 412 of file BackendUtil.cpp.

Referenced by runThinLTOBackend().

## ◆ mapToLevel()

static PassBuilder::OptimizationLevel mapToLevel | ( | const CodeGenOptions & | Opts | ) |
| static

Definition at line 891 of file BackendUtil.cpp.

References createTLII(), clang::FrontendTimesIsEnabled, clang::CodeGenOptions::hasProfileIRInstr(), clang::CodeGenOptions::hasProfileIRUse(), clang::CodeGenOptions::InstrProfileOutput, clang::CodeGenOptions::ProfileInstrumentUsePath, clang::CodeGenOptions::ProfileRemappingFile, clang::CodeGenOptions::SampleProfileFile, and setCommandLineOpts().

## ◆ runThinLTOBackend()

static void runThinLTOBackend | ( | ModuleSummaryIndex * | CombinedIndex,
|  | Module * | M,
|  | const HeaderSearchOptions & | HeaderOpts,
|  | const CodeGenOptions & | CGOpts,
|  | const clang::TargetOptions & | TOpts,
|  | const LangOptions & | LOpts,
|  | std::unique_ptr< raw_pwrite_stream > | OS,
|  | std::string | SampleProfile,
|  | std::string | ProfileRemapping,
|  | BackendAction | Action
| ) |  |
| static

Definition at line 1152 of file BackendUtil.cpp.

References clang::Backend_EmitBC, clang::Backend_EmitLL, clang::Backend_EmitNothing, clang::TargetOptions::CPU, clang::EmitBackendOutput(), clang::Error, clang::DiagnosticsEngine::Error, clang::TargetOptions::Features, clang::FindThinLTOModule(), getCGOptLevel(), getCodeGenFileType(), getCodeModel(), clang::DiagnosticsEngine::getCustomDiagID(), initTargetOptions(), clang::CodeGenOptions::OptRecordFile, clang::Module::print(), clang::CodeGenOptions::RelocationModel, clang::DiagnosticsEngine::Report(), clang::CodeGenOptions::SaveTempsFilePrefix, setCommandLineOpts(), clang::CodeGenOptions::SplitDwarfFile, and clang::CodeGenOptions::ThinLTOIndexFile.

## ◆ setCommandLineOpts()

static void setCommandLineOpts | ( | const CodeGenOptions & | CodeGenOpts | ) |
| static

Definition at line 707 of file BackendUtil.cpp.

References clang::CodeGenOptions::DebugPass, clang::Error, clang::TargetOptions::Features, getCGOptLevel(), getCodeModel(), clang::CodeGenOptions::LimitFloatPrecision, clang::CodeGenOptions::RelocationModel, clang::DiagnosticsEngine::Report(), and clang::Target.

Referenced by mapToLevel(), and runThinLTOBackend().